Alternate streams
This feature provides a vertical list of media items displayed during playback. This feature enhances user experience by providing multiple perspectives, improving immersion and interactivity.
All streams must share the same event ID, allowing the DIVA Player to synchronize video playback (multistream mode). This ensures a smooth and consistent experience when switching between streams, maintaining the playback position across different angles.
What you learn​
You're instantiating DIVA Player in your web front-end and relying on DIVA Back Office as the video streaming source.
The goal of this article is to build the simplest front-end to stream a video from the DIVA Back Office with a multistream videolist.
Before starting​
- Ensure the DIVA Back Office instance you rely on is up and running.
- Ask your video engineers team the
<video id>and the related<settings URL>. - Ensure the VideoMetadata contains the media lists data.
- Ensure the VideoMetadata
behaviorismultistreamSwitch(default),multistreamMultiviewormultistreamPip. - Ensure the VideoMetadata
rowTitleandmenuLabelare translated in the dictionary.
Instantiation​
There's no code to add to the Basic instantiation code.
The DIVA Player supports two display modes for alternate streams, controlled by the behaviour field:
Multistream Switch mode​
- The player stops the current stream and starts a new one.
- The transition occurs instantly upon user interaction.
- The icon displayed for this action is a camera (fixed and cannot be changed).
- The icon color can be customized and the label could be defined in the mediaLists data as
menuLabel.
Multistream Multiview mode​
- Multiple streams are displayed simultaneously in a split-screen.
- The user can interact with the streams independently.
- Check the multiview article for more details.
MultiStream Pip mode​
- The player is opening a new smaller video on top of the current video playing.
- The selection of a different video will affect the current video playing in the PiP player.
- Check the PiP article for more details.
- The icon displayed for this action is a small camera in a bigger video (fixed and cannot be changed).
- The icon color can be customized and the label could be defined in the mediaLists data as
menuLabel.
Working sample code (.tsx)​
Write the App() function to read the VideoMetadataMap as in the following example, and set the medialists array:
import { AssetState, BoAdapterWebComponentProps, DivaWebBoAdapter, VideoMetadata } from "@deltatre-vxp/diva-sdk/diva-web-bo-adapter";
import "@deltatre-vxp/diva-sdk/diva-web-sdk/index.min.css";
import { useState } from "react";
const itemId = "<itemId>";
const libs = {
mux: "https://cdnjs.cloudflare.com/ajax/libs/mux.js/6.2.0/mux.min.js",
shaka: "https://ajax.googleapis.com/ajax/libs/shaka-player/4.16.15/shaka-player.compiled.js",
hlsJs: "https://cdn.jsdelivr.net/npm/hls.js@1.5.7",
googleIMA: false,
googleDAI: false,
googleCast: false,
threeJs: false
};
const config = {
videoId: itemId,
libs: libs,
settings: {
general: {
timeToDisableAutoplay: 5400000
}
}
};
function App() {
const [isVideoLive, setIsVideoLive] = useState(false);
const props: BoAdapterWebComponentProps = {
settingsUrl: "<settings URL>",
languageCode: "en-US",
languageDictionary: "en-US",
onDivaBoAdapterError: console.error,
config: config,
videoMetadataMap: async (vd: VideoMetadata) => {
vd.mediaLists = [
{
listId:"xxxxxx",
rowTitle:"diva_watch_other_camera", /*default menuLabel value*/
defaulImageFormat:"tile",
defaultItemLayout: "vertical",
defaultItemType: "video",
menuLabel: "diva_other_camera", /*default empty*/
behaviour: "multistreamSwitch",
items: [
{
itemId: "12345678",
title: "France vs Croatia",
caption: "France vs Croatia",
imageUrl: "http://sw.image/img1.jpg",
},
{
itemId: "12345679"
title: "France vs Croatia",
caption: "France vs Croatia - Tactical View",
imageUrl: "http://sw.image/img2.jpg",
},
{
itemId: "12345680"
title: "Star Wars EP III - Revenge Of The Sith",
caption: "I have brought peace, freedom, justice and security to my new Empire!",
imageUrl: "http://sw.image/ep3.jpg",
ccBadge: false,
adBadge: false,
}
]
},
];
vd.behavior = {
endOfPlay: {
countdownToAutoplay: 10000
}
}
return vd;
}
};
 return (
<>
   <DivaWebBoAdapter {...props} />
</>
);
}
Dictionary​
Ensure the dictionary file contains the custom keys.