var mediaNameCTX;
var speechObj;
var nightMode = false;
-
+var waitingToResumeVideo = false; //Media has been paused by exterior forces. If set to true, resume previous media when given the signal.
var mainMenuTitleTemplateLandscape = {"font" : "oblique bolder 30pt arial", "lineWidth" : 9.5, "fillStyle" : "black", "strokeStyle" : "white", "textAlign" : "left",
"largeShadow" : 8, "shadowOffsetX" : 0, "shadowOffsetY" : 0, "shadowBlur" : 45, "shadowColor" : "rgba(255, 187, 0, 0.4)"};
console.log("MediaPlayer in setupSpeech");
speechObj = tizen.speech;
+ speechObj.vocalizeString(" ");
try
{
switch(menuButtonId)
{
case ("mainMusicButton"):
+ speechObj.vocalizeString("Music player");
currentMenu = "audio";
currentPlayer = $("#audioPlayer");
currentPlayerControls = document.getElementById("audioPlayer");
break;
case ("mainVideoButton"):
+ speechObj.vocalizeString("Video player");
currentMenu = "video";
currentPlayer = $("#videoPlayer");
currentPlayerControls = document.getElementById("videoPlayer");
break;
case ("mainImageButton"):
+ speechObj.vocalizeString("Picture viewer");
currentMenu = "image";
currentPlayer = $("#imagePlayer");
currentPlayerControls = imageControls;
function swipe(direction, object)
{
-console.log("MediaPlayer in swipe");
+ console.log("MediaPlayer in swipe");
switch (object)
{
case "mediaName":
console.log("MediaPlayer in init");
var vehicle = tizen.vehicle;
+
+ /* Subscribe to AMB NightMode signal, and switch colors
+ * upon receipt of the signal
+ */
+
vehicle.subscribe("NightMode",function(value) {
console.log("MediaPlayer: Day / Night mode changed to " + value.nightmode);
- if (nightMode !== value.nightmode)
+ if (nightMode !== value.nightmode)
{
Array.prototype.forEach.call (document.querySelectorAll ('*'), function (el) {el.classList.toggle('night');});
nightMode = value.nightmode
}
});
+ /* Subscribe to AMB DrivingMode signal, and pause video
+ * upon receipt of the signal
+ */
+
+
+ vehicle.subscribe("DrivingMode",function(value) {
+ console.log("MediaPlayer: DrivingMode changed to " + value.drivingMode);
+
+ if (value.vehicleSpeed > 0 && currentPlayerType === "VIDEO" && !currentPlayerControls.paused)
+ {
+ console.log("MediaPlayer: pausing video due to vehicle motion");
+ currentPlayerControls.pause();
+ waitingToResumeVideo = true;
+ }
+ else if (value.vehicleSpeed === 0 && currentPlayerType === "VIDEO" && waitingToResumeVideo)
+ {
+ console.log("MediaPlayer: vehicle has stopped, resuming video");
+ currentPlayerControls.play();
+ waitingToResumeVideo = false;
+ }
+
+ });
+
+
musicIcon.src = "images/musicIcon.png";
vidIcon.src = "images/videoIcon.png";
imgIcon.src = "images/imageIcon.png";
console.log("MediaPlayer: No DLNA server running, using local media only...");
//Setup voice control
- setupSpeech();
+ if (tizen.speech)
+ setupSpeech();
+ else
+ console.log("MediaPlayer: Speech Recognition not running, voice control will be unavailable");
//Get local media
getMedia(contentType);