refresh home page after video playback

This commit is contained in:
Luke Pulverenti 2015-09-20 14:17:57 -04:00
parent 18037a5943
commit c651a45dea
3 changed files with 38 additions and 4 deletions

View File

@ -249,15 +249,25 @@
pageIdOn('pageshowready', "indexPage", function () {
var page = this;
$(MediaController).on('playbackstop', onPlaybackStop);
});
pageIdOn('pagebeforehide', "indexPage", function () {
var page = this;
$(MediaController).off('playbackstop', onPlaybackStop);
});
function onPlaybackStop(e, state) {
if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
var page = $($.mobile.activePage)[0];
var pages = page.querySelector('neon-animated-pages');
$(pages).trigger('tabchange');
}
}
function getDisplayPreferences(key, userId) {
return ApiClient.getDisplayPreferences(key, userId, AppSettings.displayPreferencesKey()).done(function (result) {

View File

@ -247,8 +247,14 @@
if (player.isLocalPlayer) {
monitorPlayer(player);
}
Events.on(player, 'playbackstop', onPlaybackStop);
};
function onPlaybackStop(e, state) {
$(self).trigger('playbackstop', [state]);
}
self.getPlayerInfo = function () {
var player = currentPlayer || {};

View File

@ -316,7 +316,7 @@
window.MoviesPage = window.MoviesPage || {};
window.MoviesPage.renderSuggestedTab = loadSuggestionsTab;
$(document).on('pageinit', "#moviesPage", function () {
pageIdOn('pageinit', "moviesPage", function () {
var page = this;
@ -336,8 +336,9 @@
$(pages).on('tabchange', function () {
loadTab(page, parseInt(this.selected));
});
});
}).on('pageshowready', "#moviesPage", function () {
pageIdOn('pageshowready', "moviesPage", function () {
var page = this;
@ -360,6 +361,23 @@
}
}
$(MediaController).on('playbackstop', onPlaybackStop);
});
pageIdOn('pagebeforehide', "moviesPage", function () {
var page = this;
$(MediaController).off('playbackstop', onPlaybackStop);
});
function onPlaybackStop(e, state) {
if (state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
var page = $($.mobile.activePage)[0];
var pages = page.querySelector('neon-animated-pages');
$(pages).trigger('tabchange');
}
}
})(jQuery, document);