mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update cast icon visibility
This commit is contained in:
parent
869717c745
commit
fd80cb3da5
1 changed files with 31 additions and 21 deletions
|
@ -109,7 +109,6 @@
|
|||
*/
|
||||
CastPlayer.prototype.onInitSuccess = function () {
|
||||
console.log("init success");
|
||||
$('.btnCast').show();
|
||||
this.updateMediaControlUI();
|
||||
};
|
||||
|
||||
|
@ -128,7 +127,7 @@
|
|||
* join existing session and occur in Cast mode and media
|
||||
* status gets synced up with current media of the session
|
||||
*/
|
||||
CastPlayer.prototype.sessionListener = function(e) {
|
||||
CastPlayer.prototype.sessionListener = function (e) {
|
||||
this.session = e;
|
||||
if (this.session) {
|
||||
this.deviceState = DEVICE_STATE.ACTIVE;
|
||||
|
@ -318,7 +317,14 @@
|
|||
/**
|
||||
* Update media control UI components based on localPlayerState or castPlayerState
|
||||
*/
|
||||
CastPlayer.prototype.updateMediaControlUI = function() {
|
||||
CastPlayer.prototype.updateMediaControlUI = function () {
|
||||
|
||||
if (!chrome || !chrome.cast) {
|
||||
$('.btnCast').hide();
|
||||
return;
|
||||
}
|
||||
$('.btnCast').show();
|
||||
|
||||
if (this.deviceState == DEVICE_STATE.ACTIVE) {
|
||||
$('.btnCast').removeClass('btnDefaultCast').addClass('btnActiveCast');
|
||||
var playerState = this.castPlayerState;
|
||||
|
@ -347,10 +353,14 @@
|
|||
|
||||
window.CastPlayer = CastPlayer;
|
||||
|
||||
$(function() {
|
||||
$(function () {
|
||||
|
||||
var castPlayer = new CastPlayer();
|
||||
|
||||
$(document).on('pagebeforeshow', ".libraryPage", function () {
|
||||
|
||||
castPlayer.updateMediaControlUI();
|
||||
});
|
||||
});
|
||||
|
||||
})(window, window.chrome, console);
|
Loading…
Add table
Add a link
Reference in a new issue