diff --git a/tools/PlaybackService/src/wwwroot/favicon.ico b/tools/PlaybackService/src/wwwroot/favicon.ico new file mode 100644 index 0000000..e0f2783 Binary files /dev/null and b/tools/PlaybackService/src/wwwroot/favicon.ico differ diff --git a/tools/PlaybackService/src/wwwroot/index.html b/tools/PlaybackService/src/wwwroot/index.html index 8b7b127..c0ef1ff 100644 --- a/tools/PlaybackService/src/wwwroot/index.html +++ b/tools/PlaybackService/src/wwwroot/index.html @@ -20,9 +20,15 @@ width: 1290px; } - video { + .video-container { width: 100%; height: 360px; + background-color: black; + + & video { + width: 100%; + height: 100%; + } } .input { @@ -64,12 +70,12 @@

PlaybackService Test Page

Dash Player

- +

Shaka Player

- +
diff --git a/tools/PlaybackService/src/wwwroot/index.js b/tools/PlaybackService/src/wwwroot/index.js index 1830c78..53f882f 100644 --- a/tools/PlaybackService/src/wwwroot/index.js +++ b/tools/PlaybackService/src/wwwroot/index.js @@ -1,12 +1,6 @@ -async function dashinit() { - const video = document.querySelector("video") - video.pendingSessionData = [] - video.addEventListener('encrypted', handleEncryption(video)) - const player = dashjs.MediaPlayer().create() - player.initialize(video, video.src, true) -} - function play() { + removePlayers(); + showError("error", ""); showError("dash-error", ""); showError("shaka-error", ""); @@ -43,7 +37,7 @@ function play() { } function dashPlay(playUri) { - var video = document.getElementById("dashvideo"); + var video = createVideoElement(document.getElementById("dashvideo-container")); var player = dashjs.MediaPlayer().create(); player.initialize(video, playUri, true); player.on("error", (e) => { @@ -66,7 +60,7 @@ function dashPlay(playUri) { } async function shakaPlay(playUri) { - var video = document.getElementById("shakavideo"); + var video = createVideoElement(document.getElementById("shakavideo-container")); var player = new shaka.Player(video); player.addEventListener("error", (e) => { console.log("shaka-error"); @@ -96,3 +90,27 @@ function showError(domId, msg) { var errorDom = document.getElementById(domId); errorDom.innerHTML = `${msg}`; } + +function removePlayers() +{ + var videos = document.getElementsByTagName("video"); + while (videos.length) { + videos[videos.length - 1].remove(); + } +} + +function clearVideoElement(parent) +{ + while (parent.firstChild) { + parent.removeChild(parent.lastChild); + } +} + +function createVideoElement(parent) +{ + var video = document.createElement('video'); + video.setAttribute("controls", "controls"); + video.setAttribute("autoplay", "autoplay"); + parent.appendChild(video); + return video; +} \ No newline at end of file