mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added chromecast icon
This commit is contained in:
parent
3d0e125dd3
commit
869717c745
16 changed files with 59 additions and 0 deletions
|
@ -82,7 +82,12 @@
|
|||
*/
|
||||
CastPlayer.prototype.initializeCastPlayer = function () {
|
||||
|
||||
if (!chrome) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chrome.cast || !chrome.cast.isAvailable) {
|
||||
setTimeout(this.initializeCastPlayer.bind(this), 1000);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -94,6 +99,8 @@
|
|||
this.sessionListener.bind(this),
|
||||
this.receiverListener.bind(this));
|
||||
|
||||
console.log('chrome.cast.initialize');
|
||||
|
||||
chrome.cast.initialize(apiConfig, this.onInitSuccess.bind(this), this.onError.bind(this));
|
||||
};
|
||||
|
||||
|
@ -102,6 +109,7 @@
|
|||
*/
|
||||
CastPlayer.prototype.onInitSuccess = function () {
|
||||
console.log("init success");
|
||||
$('.btnCast').show();
|
||||
this.updateMediaControlUI();
|
||||
};
|
||||
|
||||
|
@ -110,6 +118,7 @@
|
|||
*/
|
||||
CastPlayer.prototype.onError = function () {
|
||||
console.log("error");
|
||||
$('.btnCast').hide();
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -306,6 +315,36 @@
|
|||
//this.updateDisplayMessage();
|
||||
};
|
||||
|
||||
/**
|
||||
* Update media control UI components based on localPlayerState or castPlayerState
|
||||
*/
|
||||
CastPlayer.prototype.updateMediaControlUI = function() {
|
||||
if (this.deviceState == DEVICE_STATE.ACTIVE) {
|
||||
$('.btnCast').removeClass('btnDefaultCast').addClass('btnActiveCast');
|
||||
var playerState = this.castPlayerState;
|
||||
} else {
|
||||
$('.btnCast').removeClass('btnActiveCast').addClass('btnDefaultCast');
|
||||
var playerState = this.localPlayerState;
|
||||
}
|
||||
|
||||
switch (playerState) {
|
||||
case PLAYER_STATE.LOADED:
|
||||
case PLAYER_STATE.PLAYING:
|
||||
//document.getElementById("play").style.display = 'none';
|
||||
//document.getElementById("pause").style.display = 'block';
|
||||
break;
|
||||
case PLAYER_STATE.PAUSED:
|
||||
case PLAYER_STATE.IDLE:
|
||||
case PLAYER_STATE.LOADING:
|
||||
case PLAYER_STATE.STOPPED:
|
||||
//document.getElementById("play").style.display = 'block';
|
||||
//document.getElementById("pause").style.display = 'none';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
window.CastPlayer = CastPlayer;
|
||||
|
||||
$(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue