// videoplayer.js // // Copyright (C) 2011-2015 Werft22 AG, Andreas Trottmann // // videoplayer Javascript // // Revision: $Revision: 2305 $ // Last change: $Date: 2015-07-22 18:31:41 +0200 (Wed, 22 Jul 2015) $ // JavaScript Document Videoplayer = new Object(); Videoplayer.init = function($e) { if(document.getElementById("w22player") != undefined) Videoplayer.flashMovie = document.getElementById("w22player"); else Videoplayer.flashMovie = document.getElementById("w22editor"); Videoplayer.playState = "paused"; //alert("INIT "+Videoplayer.flashMovie); } Videoplayer.setFocus = function($e) { //alert("FOCUS"); Videoplayer.flashMovie.focus(); } Videoplayer.setBandwidth = function($bandwidths) { var controllerForm = document.forms["videoControllerForm"]; var bwSwitch = controllerForm.elements["bandwidthSelect"]; for (var i=0; i < bwSwitch.options.length; i++) { bwSwitch.options[i] = null; } // remove all option first for (var i in $bandwidths) { bwSwitch.options[i] = new Option($bandwidths[i].label, $bandwidths[i].streamID); if ($bandwidths[i].selected == true) bwSwitch.options[i].selected = true; } // populate Select Box with current available Streams } Videoplayer.changeBandwidth = function($stream) { Videoplayer.flashMovie.command("changeBandwidth", $stream); } Videoplayer.loadStreamData = function($ID) { Videoplayer.flashMovie.command("loadStreamData", $ID); } Videoplayer.play = function() { Videoplayer.flashMovie.command("play"); } Videoplayer.onPlay = function($param) { Videoplayer.playState = $param; var playButton = document.getElementById("videoPlayButton"); if ($param == "paused") playButton.innerHTML = $('text_button_play').value; else playButton.innerHTML = $('text_button_pause').value; } Videoplayer.pause = function() { try { if(Videoplayer.playState == "playing") { Videoplayer.flashMovie.command("play"); } } catch(e) { } } Videoplayer.onRecord = function() { var now = new Date(); if(this.lastRecordTime != undefined) { if(now.getTime() < (Videoplayer.lastRecordTime + 20000)) { return; } } this.lastRecordTime = now.getTime(); var movieId = document.getElementById('movie_id').value; var xmlHttp = null; if (typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } if (!xmlHttp) { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { xmlHttp = null; } } } xmlHttp.onreadystatechange = function() { if(this.readyState == 4) { alert($('text_record').value); } } xmlHttp.open("POST", "show.w22?xf_action=recordchannel;xf_id=" + movieId, true); xmlHttp.send(null); } Videoplayer.onStatus = function($status) { var timeDisplay = document.getElementById("timeDisplay"); if(timeDisplay != undefined) { timeDisplay.innerHTML = status.prefix+" "+$status.time; } if(onStatusCallback != undefined) { onStatusCallback($status); } } Videoplayer.switchTime = function() { Videoplayer.flashMovie.command("switchTime"); } Videoplayer.mute = function() { Videoplayer.flashMovie.command("mute"); } Videoplayer.onMute = function($mute) { var muteButton = document.getElementById("muteButton"); muteButton.innerHTML = ($mute == true) ? $('text_sound_on').value : $('text_sound_off').value; } Videoplayer.onSetSubtitle = function($subtitle) { var subtitleLayer = document.getElementById("subtitles"); subtitleLayer.innerHTML = $subtitle; } Videoplayer.onClearSubtitle = function() { var subtitleLayer = document.getElementById("subtitles"); subtitleLayer.innerHTML = " "; } Videoplayer.saveCueData = function() { Videoplayer.flashMovie.command("saveCueData"); }