added chromecast icon
18
dashboard-ui/css/chromecast.css
Normal file
|
@ -0,0 +1,18 @@
|
|||
.btnCast {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
background-size: 100%;
|
||||
vertical-align: middle;
|
||||
margin: 0 .6em;
|
||||
}
|
||||
|
||||
.btnDefaultCast {
|
||||
background-image: url(images/chromecast/ic_notification_media_route.png);
|
||||
}
|
||||
|
||||
.btnActiveCast {
|
||||
background-image: url(images/chromecast/ic_media_route_on_holo_dark.png);
|
||||
}
|
After Width: | Height: | Size: 1 KiB |
After Width: | Height: | Size: 1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 768 B |
|
@ -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() {
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
html += '<div class="viewMenuSecondary">';
|
||||
|
||||
html += '<button class="btnCast btnDefaultCast" type="button" data-role="none" style="display:none;"></button>';
|
||||
|
||||
html += '<a class="viewMenuLink btnCurrentUser" href="#" onclick="Dashboard.showUserFlyout(this);">';
|
||||
|
||||
if (user.PrimaryImageTag) {
|
||||
|
|