Skip to main content
Version: v3

Module Intro

Important Attention Reminder

Coding Style wiki


Basic Instructions

Audio/Video module (linked with AssetLoader to achieve automatic unloading), covering the production of game Audio (2D/3D) and Video, supporting multi-platform loading methods (Local, StreamingAssets, URL).

  • Audio Management (AudioFrame)
  • Video Management (VideoFrame)

Important Additionally, detail correction has been performed for Audio on the WebGL platform because WebGL cannot obtain the correct length for Audio Clip requests (Official gives up fixing), resulting in some defects in audio control. Therefore, during prefab production, Preload can be used to request Clip length for pre-setting.

Application Description

AudioFrame

Used to play Audio, using AudioManager to manage Prefabs with AudioBase mounted, and employing Unity Mixer for controlling each track.

Important You need to drag the AudioManager prefab into the Hierarchy window first (imported from Package Manager).

  • Audio Sound Type Description:
    • Sole: Uniqueness (cannot be replayed), recommended types are BGM (Background Music), Voice (Dubbing), etc.
    • SoundEffect: Multi-instance (can be replayed), recommended types are Fight Sound (Combat sound effect), General Sound (General sound effect), etc.

Reminder Default Master Mixer has been provided, you can also define your own.

VideoFrame

Used to play Video, using VideoManager to manage Prefabs with VideoBase mounted, and supporting RenderTexture, Camera.

  • Video Render Mode Description:
    • RenderTexture: Maps the video to RenderTexture and then renders it through UGUI's RawImage (VideoBase uses RenderTexture.GetTemporary and RenderTexture.ReleaseTemporary to create and release, ensuring correct memory release of RenderTexture).
    • Camera: Renders directly through Camera.

Supports adjustment of timeline and playback speed.


Other Instructions

Media [MediaConfig] (Media URL Config) Format

If audio and video sources are stored on Cloud services, you can request files using URL. The format is as follows (If URL is not specified through MediaConfig.txt, you can also enter the full resource URL in the Prefab, but the disadvantage is that for future URL changes, maintenance will be very troublesome):

# 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/

>> How to establish MediaConfig.txt <<

  • Click OxGFrame -> MediaFrame -> Media Url Config Generator via MenuItem to start creating MediaConfig.txt (StreamingAssets/MediaConfig.txt).

>> How to load MediaConfig.txt <<

  1. If Url Cfg Request Type = Assign is selected, then specify MediaConfig.txt in the prefab.
  2. If Url Cfg Request Type = Streaming Assets is selected, the MediaConfig.txt file will be requested from StreamingAssets.

Reminder Additional Description: If requesting audio or video resources through URL, it is recommended to use it on the WebGL platform because WebGL does not support pre-specifying AudioClip or VideoClip (Assign method) to the Prefab in AssetBundle. Therefore, the URL method is provided for requesting audio/video files.