-
Notifications
You must be signed in to change notification settings - Fork 18
Local Overrides Sample: Network Delay Triggers Video Restart
bp2008 edited this page Dec 18, 2022
·
5 revisions
This sample causes the video stream to be restarted if network delay grows beyond a specific amount. This sample requires UI3-113 or newer due to the use of a new API method: videoPlayer.GetPlayerObject()
To learn more about ui3-local-overrides, see: Local Overrides Scripts and Styles
// UI3 Local Overrides Sample - Network Delay Triggers Video Restart
var maximumNetworkDelay = 3000; // milliseconds
setInterval(function ()
{
var h264_player = videoPlayer.GetPlayerObject();
if (h264_player)
{
if (h264_player.GetNetworkDelay() > maximumNetworkDelay)
{
console.log("Refreshing video stream because of high network delay");
videoPlayer.RefreshVideoStream();
}
}
}, 1000);
// UI3 Local Overrides Sample - Network Delay Triggers Video Restart
var maximumNetworkDelay = 3000; // milliseconds
setInterval(function ()
{
var h264_player = videoPlayer.GetPlayerObject();
if (h264_player)
{
if (h264_player.GetNetworkDelay() > maximumNetworkDelay || h264_player.GetBufferedTime() > maximumNetworkDelay)
{
console.log("Refreshing video stream because of high network delay");
videoPlayer.RefreshVideoStream();
}
}
}, 1000);