Skip to main content
Version: v3

MediaHelper

Important Attention Reminder

Coding Style wiki


MediaHelper is the MediaFrame editor helper, used to export the media (Audio / Video) URL config file so the client can resolve audio and video source addresses dynamically.

NamespaceOxGFrame.MediaFrame.Editor
Typepublic static class
SourceMediaHelper.cs
using OxGFrame.MediaFrame.Editor;

Attention This class is for the Unity Editor environment only.

Method Overview

MethodDescription
ExportMediaUrlConfigExports the media URL config file (MediaConfig.txt) to the given path.

ExportMediaUrlConfig

public static void ExportMediaUrlConfig(string audioUrlset, string videoUrlset, string outputPath)

Parameters

ParameterTypeDescription
audioUrlsetstringAudio asset server URL. If empty, the default http://127.0.0.1/audio/ is used.
videoUrlsetstringVideo asset server URL. If empty, the default http://127.0.0.1/video/ is used.
outputPathstringOutput directory path for the config file (the file name is fixed as MediaConfig.txt).

Description

Exports the audio and video source server URLs into a MediaConfig.txt config file at the given path — typically the built-in StreamingAssets — so the client can resolve audio and video source addresses dynamically when playing in URL mode.

The output contains explanatory comments starting with # and is written in UTF-8 encoding to ensure cross-platform compatibility:

# audio_urlset = Audio Source Url Path
# video_urlset = Video Source Url Path

audio_urlset http://127.0.0.1/audio/
video_urlset http://127.0.0.1/video/

Reminder You can also generate the file with the editor window tool via the menu OxGFrame → MediaFrame → Media Url Config Generator (MediaConfig.txt).

Example

using OxGFrame.MediaFrame.Editor;
using UnityEngine;

MediaHelper.ExportMediaUrlConfig(
"https://cdn.example.com/audio/",
"https://cdn.example.com/video/",
Application.streamingAssetsPath
);