In order to make use of a media surface, you must set a Video stream URL.
The Media Surface Settings section of the Scene Settings panel allows you to set a media URL and set the location and volume of audio playback in the scene for that media URL.
|Media Surface Settings in the Scene Settings panel.|
You can adjust the following settings:
- Name - Enter a name for the media stream. This is helpful for identifying the stream when setting up audio emitters for positional audio.
- Video stream URL - Enter the URL of a web page you would like to play in your scene. Note that the media only plays once and then stops unless otherwise specified by the URL. Read on below for more information on how to properly format a YouTube or a Twitch URL for media surfaces.
- Initial Width - Set the height of the media, in pixels (e.g. 1920 for most 1080p videos).
- Initial Height - Set the width of the media, in pixels (e.g. 1080 for most 1080p videos).
Note: In order to hear audio for a media stream, you must also set up an audio emitter to play the audio portion of the stream.
YouTube (including live content) is officially supported for video playback. For the best playback experience, you need to format your media URL using specific flags:
http://www.youtube.com/embed/[VIDEO_ID]?autoplay=1&loop=1&controls=0&allowfullscreen=1&playlist=[VIDEO_ID], where [VIDEO_ID] is the unique ID for the video.
Here are step-by-step instructions on how to construct the YouTube URL:
- Make sure to use the embed link (only the part in quotes after "src=" in the Embed field).
- Take note of the video ID, which is the text after the last forward slash in the embed link. For example:
YouTube Link Video ID https://www.youtube.com/embed/oa1s4pka2pA oa1s4pka2pA
- Add (with no space in between):
?autoplay=1&loop=1&controls=0&allowfullscreen=1&playlist=after the embed link.
- Then, add the video ID after that string. For example, the media URL for the Sansar trailer (with the video ID "
a1s4pka2pA") would be:
Twitch is officially supported for video playback in Sansar. For the best experience, format your media URL as follows:
[CHANNEL_ID]is the channel's unique ID.
- Alternatively, you can use
[CHANNEL_ID]is the channel's unique ID and
/chides chat. However, this link format also displays some of the website's user interface elements in the upper-right corner of the media surface.
You may use audio emitters to play up to four different audio streams in an experience.
To set the audio streams for a scene:
- While editing the scene, open the Scene Properties panel by choosing Tools > Scene Settings.
- Under Web Audio Streams in the Scene Properties panel, enter info for up to four streams:
- Name - Choose a name for the audio stream. This is a useful identifier when setting up audio emitters to play the stream.
- Audio stream URL - Set a URL for streaming audio content.
- Place an audio emitter in the scene, set its Sound Source to Stream, and choose one of the audio streams from the dropdown list.
|Web audio streams in the Scene Settings panel.|
You can preview your audio and media content by toggling Audio/Video preview in the Options menu while editing a scene. For more information on previewing media and audio in your scene, see Previewing audio and video in a scene.
|Use Audio/Video preview to play your scene's media and sounds while editing the scene.|
Media surfaces can occasionally fail to play back media. The workaround for this temporary issue is to force the stream to reload, as follows:
- Enable Options > Audio/Video preview.
- Verify that the media surface isn’t playing and remains white.
- Disable Audio/Video preview.
- Open Tools > Scene Settings.
- Scroll down to Background Sound in the Properties panel.
- Set Sound Source to Stream.
- Choose an Audio stream (not the Media stream).
- Save the scene.
- Open My Experiences from the App Launcher and reload the scene by clicking Edit this scene.
- Open Tools > Scene Settings.
- Scroll down to Background Sound in the Properties panel and set it to the Media stream.
- Save the Scene.
- Enable Audio/Video preview.
- Verify that the media surface is playing as intended.
You may need to repeat these steps multiple times before the media stream plays successfully.