MediaHelper
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.
| Namespace | OxGFrame.MediaFrame.Editor |
| Type | public static class |
| Source | MediaHelper.cs |
using OxGFrame.MediaFrame.Editor;
Attention This class is for the Unity Editor environment only.
Method Overview
| Method | Description |
|---|---|
| ExportMediaUrlConfig | Exports the media URL config file (MediaConfig.txt) to the given path. |
ExportMediaUrlConfig
public static void ExportMediaUrlConfig(string audioUrlset, string videoUrlset, string outputPath)
Parameters
| Parameter | Type | Description |
|---|---|---|
| audioUrlset | string | Audio asset server URL. If empty, the default http://127.0.0.1/audio/ is used. |
| videoUrlset | string | Video asset server URL. If empty, the default http://127.0.0.1/video/ is used. |
| outputPath | string | Output 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
);