From 40f7c73390a9f9bea07303ebd2970268a7ce944f Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 8 Jun 2019 00:54:55 +0200 Subject: [PATCH] Fix the video player that was broken in cf1f86f --- .../main/webapp/WEB-INF/jsp/videoPlayer.jsp | 12 ++++++++- .../src/main/webapp/script/videoPlayerCast.js | 26 +++++++++---------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/airsonic-main/src/main/webapp/WEB-INF/jsp/videoPlayer.jsp b/airsonic-main/src/main/webapp/WEB-INF/jsp/videoPlayer.jsp index 62ccfd20..13db32e2 100644 --- a/airsonic-main/src/main/webapp/WEB-INF/jsp/videoPlayer.jsp +++ b/airsonic-main/src/main/webapp/WEB-INF/jsp/videoPlayer.jsp @@ -8,7 +8,6 @@ - + diff --git a/airsonic-main/src/main/webapp/script/videoPlayerCast.js b/airsonic-main/src/main/webapp/script/videoPlayerCast.js index f5d49f91..1e98f427 100644 --- a/airsonic-main/src/main/webapp/script/videoPlayerCast.js +++ b/airsonic-main/src/main/webapp/script/videoPlayerCast.js @@ -77,7 +77,7 @@ this.currentMediaTime = 0; // @type {Number} A number for current media duration - this.currentMediaDuration = ${empty model.duration ? 0: model.duration}; + this.currentMediaDuration = model.duration; // @type {Boolean} A boolean to stop timer update of progress when triggered by media status event this.seekInProgress = false; @@ -283,7 +283,7 @@ this.currentMediaOffset = offset; this.currentMediaTime = 0; - var url = "${model.remoteStreamUrl}" + "&maxBitRate=" + this.getBitRate() + "&format=mkv&timeOffset=" + offset; + var url = model.remoteStreamUrl + "&maxBitRate=" + this.getBitRate() + "&format=mkv&timeOffset=" + offset; console.log("casting " + url); var mediaInfo = new chrome.cast.media.MediaInfo(url); mediaInfo.contentType = 'video/x-matroska'; @@ -291,8 +291,8 @@ mediaInfo.duration = this.currentMediaDuration; mediaInfo.metadata = new chrome.cast.media.MovieMediaMetadata(); mediaInfo.metadata.metadataType = chrome.cast.media.MetadataType.MOVIE; - mediaInfo.metadata.title = "${model.video.title}"; - mediaInfo.metadata.images = [new chrome.cast.Image("${model.remoteCoverArtUrl}&size=384")]; + mediaInfo.metadata.title = model.video_title; + mediaInfo.metadata.images = [new chrome.cast.Image(model.remoteCoverArtUrl + "&size=384")]; var request = new chrome.cast.media.LoadRequest(mediaInfo); request.autoplay = this.autoplay; @@ -446,7 +446,7 @@ this.currentMediaOffset = offset; this.currentMediaTime = 0; - var url = "${model.streamUrl}" + "&maxBitRate=" + this.getBitRate() + "&timeOffset=" + offset; + var url = model.streamUrl + "&maxBitRate=" + this.getBitRate() + "&timeOffset=" + offset; console.log("playing local: " + url); this.localPlayer.src = url; @@ -491,14 +491,14 @@ * Share the video. */ CastPlayer.prototype.share = function () { - location.href = "createShare.view?id=${model.video.id}"; + location.href = "createShare.view?id=" + model.video_id; }; /** * Download the video. */ CastPlayer.prototype.download = function () { - location.href = "download.view?id=${model.video.id}"; + location.href = "download.view?id=" + model.video_id; }; /** @@ -678,12 +678,12 @@ $("#share").on('click', this.share.bind(this)); $("#download").on('click', this.download.bind(this)); - - $("#share").hide(); - - - $("#download").hide(); - + if (model.hide_share) { + $("#share").hide(); + } + if (model.hide_download) { + $("#download").hide(); + } // setInterval(this.updateDebug.bind(this), 100); };