Nokia World 2013 Live Webcast.

Nokia World 2013 Live Webcast.

// returns if the browser / player installations allows for working with windows media
this.isSupported = function () {
var supported = false;
if (browserCheck && browserCheck.platform == “win”) {
if (browserCheck.browser_type == “ie” && browserCheck.browser_version >= 6 && browserCheck.wmp >= 9) {
supported = true;
} else if (browserCheck.browser_type != “-” && browserCheck.wmp >= 11) {
supported = true;
}
}
return supported;
}

this.draw = function (width, height)
{
width = Math.ceil(width) || 1;
height = Math.ceil(height) || 1;

if (browserCheck && this.player == null) {
if (browserCheck.browser_type == “ie”) {
out = ““;
out += ” “;
out += ” “;
out += ” “;
out += “<\/ob" + "ject>\n”;
this.include_type = “object”;
} else { // application/x-ms-wmp
out = ““;
out += ‘ ‘;
out += ‘ ‘;
out += ‘ ‘;
out += ‘ ‘;
out += ” “;
out += ” “;
out += ” “;
out += ” “;
out += “<\/ob" + "ject>\n”;
this.include_type = “x-ms-wmp”;
}

var wmv_cnt_inner2 = document.getElementById(“wmv_cnt_inner2”);
if (wmv_cnt_inner2) {
wmv_cnt_inner2.innerHTML = out;
this.player = document.getElementById(“wmv_player”);
}
}
}

// draws the windows media player
this.load = function (config)
{
config = config || {};
var left = config.left || 0;
var top = config.top || 0;
var width = config.width || 0;
var height = config.height || 0;
var stretchX = config.stretchX != undefined ? config.stretchX : 0;
var stretchY = config.stretchY != undefined ? config.stretchY : 0;
this.flash_id = config.flash_id || “”;
this.autostart = config.autostart || false;
this.media_type = config.media_type || “”;
this.start_position = config.start_position;
this.volume = (config.volume != null)? config.volume : this.volume;
this.sound_on = (config.sound_on != null)? config.sound_on : this.sound_on;
this.is_live = (config.is_live != null)? config.is_live : false;
var url = config.url || false;

if (this.player != null && browserCheck && browserCheck.browser_type != “ie”) {
var wmv_cnt_inner2 = document.getElementById(“wmv_cnt_inner2”);
if (wmv_cnt_inner2) {
wmv_cnt_inner2.removeChild(this.player);
this.player = null;
}
}
if (this.player == null) {
this.draw(width, height);
}
if (this.player != null && this.player.settings) {
if (this.media_type == “video”) {
this.setXY(left, top);
this.setSize(width, height, stretchX, stretchY);
}
this.setVolume(this.volume);
this.player.settings.autoStart = this.autostart;
this.player.URL = url;
}
this.show(this.media_type == “video” && this.autostart);
}

// is called on mouse-klick and key events. if player settings were changed directly, changes are reported to flash
this.checkSettings = function () {
if (this.player && this.flash_id != “” && flash_player) {
if (this.volume != this.player.settings.volume) {
this.volume = this.player.settings.volume;
if (flash_player) {
eval(“flash_player.” + this.flash_id + “_externalClipReceiver(‘volume’,” + this.volume + “);”);
}
}
if (this.sound_on != !this.player.settings.mute) {
this.sound_on = !this.player.settings.mute;
if (flash_player) {
eval(“flash_player.” + this.flash_id + “_externalClipReceiver(‘sound’,'” + (this.sound_on ? “on” : “off”) + “‘);”);
}
}
if (this.fullscreen != this.player.fullScreen) {
this.fullscreen = this.player.fullScreen;
if (flash_player) {
eval(“flash_player.” + this.flash_id + “_externalClipReceiver(‘fullscreen’,'” + (this.fullscreen ? “true” : “false”) + “‘);”);
}
}
}
}

this.setStreamTime = function (timestamp) {
if (!isNaN(timestamp)) {
this.stream_time = { last_received: (new Date()).getTime() / 1000, value: timestamp};
}
}

this.getTimeDebugging = function() {
return “last received ” + (new Date(this.stream_time.last_received * 1000)).toString() + ” data: ” + this.stream_time.value;
}

this.setPlayState = function (newState) {
this.play_state = newState;
if (flash_player && this.start_position > 0 && (newState == 3 || newState == 6)) {
this.setPosition(this.start_position);
this.start_position = 0;
}
this.setSound(this.sound_on);
}

// set position of wm-plugin
this.setXY = function (left, top) {
var wmv_cnt_outer = document.getElementById(“wmv_cnt_outer”);
if (wmv_cnt_outer) {
wmv_cnt_outer.style.left = left;
wmv_cnt_outer.style.top = top;
}
}

this.setSize = function(width, height, stretchX, stretchY) {
var wmv_iframe = document.getElementById(“wmv_iframe”);
width = (width > 0)? Math.ceil(width) : 1;
height = (height > 0)? Math.ceil(height) : 1;
stretchX = stretchX != undefined ? Math.ceil(stretchX) : 0;
stretchY = stretchY != undefined ? Math.ceil(stretchY) : 0;
if (this.player && wmv_iframe) {
wmv_iframe.style.width = width;
wmv_iframe.style.height = height;
wmv_iframe.width = width;
wmv_iframe.height = height;
this.player.width = width + stretchX;
this.player.height = height + stretchY;
}
}

this.startPlaying = function (show_it) {
if (this.player) {
this.show(show_it && this.media_type == “video”);
this.player.controls.play();
}
}

this.pausePlaying = function () {
if (this.player) {
this.player.controls.pause();
}
}

this.stopPlaying = function () {
if (this.player) {
this.player.controls.stop();
}
}

this.getStatus = function()
{
// there seems to be no event firing for fullscreen so we also put hte check here as this function is called frequently
if (this.fullscreen != this.player.fullScreen) {
this.fullscreen = this.player.fullScreen;
if (flash_player && !this.fullscreen) {
eval(“flash_player.” + this.flash_id + “_externalClipReceiver(‘fullscreen’,false);”);
}
}
return this.play_state;
}

this.getDuration = function ()
{
return this.player? this.player.currentMedia.duration : 0;
}

this.getBuffering = function () {
return this.player? this.player.network.bufferingProgress : 0;
}

this.getAmountLoaded = function () {
return this.player? this.player.network.getAmountLoaded : 0;
}

this.getPosition = function ()
{
if (this.is_live && this.stream_time.last_received > 0) {
// interpolate time since the last timestamp arrived but only to one digit accuracy
var since_last_received = Math.floor(((new Date()).getTime() / 100) – this.stream_time.last_received * 10) / 10;
// stop interpolating time if last timestamp received was longer than 2 seconds ago
if (since_last_received < 2) { return Number(this.stream_time.value) + Number(since_last_received); } else { return this.stream_time.value + 2; } } else { return this.player? this.player.controls.currentPosition : 0; } } this.setPosition = function (pos) { if (this.player) { this.player.controls.currentPosition = Number(pos); } }