From 1682819891ed81ba3837f9746fe55e322066eb7f Mon Sep 17 00:00:00 2001 From: thlo Date: Thu, 27 Dec 2012 23:10:17 +0100 Subject: Correction of TotalPlaytime string. --- smarttv-client/Javascript/Config.js | 5 ++--- smarttv-client/Javascript/Main.js | 29 +++++++++++++++++++++++++++-- smarttv-client/Javascript/Player.js | 5 +++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js index 9e111d9..518c6e6 100755 --- a/smarttv-client/Javascript/Config.js +++ b/smarttv-client/Javascript/Config.js @@ -2,7 +2,7 @@ var Config = { cfgFileName : "", XHRObj : null, xmlDocument : null, - serverUrl : "http://192.168.1.122:8000", // Will become the main URL for contacting the server. Form "http://:port" + serverUrl : "", // Will become the main URL for contacting the server. Form "http://:port" serverAddr : "", serverAddrDefault: "192.168.1.122:8000", format :"has", @@ -46,14 +46,13 @@ Config.init = function () { this.cfgFileName = curWidget.id + "/config.dta"; } catch (e) { - Main.log("curWidget.id does not exists. Is that a Samsung?"); + Main.log("curWidget.id does not exists. Is that really a Samsung?"); return; }; var fileSystemObj = new FileSystem(); if (fileSystemObj.isValidCommonPath(curWidget.id) == 0){ -// Display.showPopup ("First Launch of the Widget --> Launching Config Menu"); Main.log("First Launch of the Widget"); // should switch to the config screen here var res = fileSystemObj.createCommonDir(curWidget.id); diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js index a122557..ca82fe4 100755 --- a/smarttv-client/Javascript/Main.js +++ b/smarttv-client/Javascript/Main.js @@ -7,6 +7,26 @@ try { } catch (e) { } + +/* + * Config.deviceType is used to differentiate main devices. + * Config.deviceType == 0 is a Samsung ES Series Device (2012) + * Config.deviceType != 0 is currently a Chrome Browser (Only GUI, no Video Playback) + * + * In order to adjust to other devices: + * Config.js: realization of persistent storage for variable "Config.serverUrl" (URL of server plugin) + * + * Handle KeyCodes: global variable tvKey holds an enum + * event.keyCode: is used to get the key pressed + * + * Display.putInnerHTML: Samsung specific way to hanle innerHTML + * Display.GetEpochTime: returns the current time (UTC) in seconds + * + * Audio: Get and Set Volume + * Player: All operations to get the video playing + * + */ + //var custom = window.deviceapis.customdevice || {}; @@ -293,6 +313,8 @@ Main.playItem = function (url) { Player.bufferState = 0; Player.isRecording = false; Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000; + Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0); + // Display.updateTotalTime(Player.totalTime); var digi = new Date((Data.getCurrentItem().childs[Main.selectedVideo].payload.start*1000)); Main.log (" Date(): StartTime= " + digi.getHours() + ":" + digi.getMinutes() + ":" + digi.getSeconds()); @@ -309,13 +331,16 @@ Main.playItem = function (url) { Player.isLive = false; Player.isRecording = false; Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now)); - if ((now - (start_time + duration)) < 0) { + + Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000; + Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0); + + if ((now - (start_time + duration)) < 0) { // still recording Main.log("*** Still Recording! ***"); Player.isRecording = true; Player.startTime = start_time; Player.duration = duration; - Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000; document.getElementById("olRecProgressBar").style.display="block"; Display.updateRecBar(start_time, duration); diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js index 716f36c..404cfda 100755 --- a/smarttv-client/Javascript/Player.js +++ b/smarttv-client/Javascript/Player.js @@ -304,8 +304,9 @@ Player.OnStreamInfoReady = function() { if ((Player.isLive == false) && (Player.isRecording == false)) { Player.totalTime = Player.plugin.GetDuration(); } - Player.curPlayTimeStr = Display.durationString(Player.totalTime / 1000.0); - +// Player.curPlayTimeStr = Display.durationString(Player.totalTime / 1000.0); + Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0); + /* var height = Player.plugin.GetVideoHeight(); var width = Player.GetVideoWidth(); Display.showPopup("Resolution= " + height + " x " +width); -- cgit v1.2.3