Merge pull request #1812 from iwalton3/show-mobile-seek

Show seek buttons when playing video on mobile.
This commit is contained in:
dkanada 2020-08-28 23:26:59 +09:00 committed by GitHub
commit 4d540bf9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 34 deletions

View File

@ -248,8 +248,6 @@
}
@media all and (max-width: 30em) {
.btnFastForward,
.btnRewind,
.osdMediaInfo,
.osdPoster {
display: none !important;

View File

@ -222,18 +222,10 @@
margin: 0;
}
.layout-mobile .nowPlayingSecondaryButtons .btnShuffleQueue {
display: none;
}
.layout-mobile .nowPlayingSecondaryButtons .volumecontrol {
display: none;
}
.layout-mobile .nowPlayingSecondaryButtons .btnRepeat {
display: none;
}
.layout-desktop .nowPlayingInfoButtons .btnRepeat,
.layout-tv .nowPlayingInfoButtons .btnRepeat {
display: none;
@ -362,7 +354,8 @@
border-radius: 0;
}
.nowPlayingInfoButtons .btnRepeat {
.nowPlayingInfoButtons .btnRepeat,
.nowPlayingInfoButtons .btnRewind {
position: absolute;
left: 0;
margin-left: 0;
@ -370,7 +363,8 @@
font-size: smaller;
}
.nowPlayingInfoButtons .btnShuffleQueue {
.nowPlayingInfoButtons .btnShuffleQueue,
.nowPlayingInfoButtons .btnFastForward {
position: absolute;
right: 0;
margin-right: 0;
@ -468,7 +462,6 @@
}
@media all and (max-width: 63em) {
.nowPlayingSecondaryButtons .repeatToggleButton,
.nowPlayingInfoButtons .playlist .listItemMediaInfo,
.nowPlayingInfoButtons .btnStop {
display: none !important;

View File

@ -134,7 +134,7 @@ function imageUrl(item, options) {
function updateNowPlayingInfo(context, state, serverId) {
const item = state.NowPlayingItem;
const displayName = item ? getNowPlayingNameHtml(item).replace('<br/>', ' - ') : '';
if (typeof item !== 'undefined') {
if (item) {
const nowPlayingServerId = (item.ServerId || serverId);
if (item.Type == 'Audio' || item.MediaStreams[0].Type == 'Audio') {
const songName = item.Name;
@ -192,11 +192,11 @@ function updateNowPlayingInfo(context, state, serverId) {
context.querySelector('.nowPlayingPageTitle').classList.add('hide');
}
const url = item ? seriesImageUrl(item, {
const url = seriesImageUrl(item, {
maxHeight: 300
}) || imageUrl(item, {
maxHeight: 300
}) : null;
});
let contextButton = context.querySelector('.btnToggleContextMenu');
// We remove the previous event listener by replacing the item in each update event
@ -228,7 +228,6 @@ function updateNowPlayingInfo(context, state, serverId) {
});
});
setImageUrl(context, state, url);
if (item) {
backdrop.setBackdrops([item]);
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
const userData = fullItem.UserData || {};
@ -241,7 +240,6 @@ function updateNowPlayingInfo(context, state, serverId) {
context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = '';
}
}
}
function setImageUrl(context, state, url) {
const item = state.NowPlayingItem;
@ -332,8 +330,14 @@ export default function () {
buttonVisible(context.querySelector('.btnNextTrack'), item != null);
buttonVisible(context.querySelector('.btnPreviousTrack'), item != null);
if (layoutManager.mobile) {
buttonVisible(context.querySelector('.btnRewind'), false);
buttonVisible(context.querySelector('.btnFastForward'), false);
const playingVideo = playbackManager.isPlayingVideo() && item !== null;
const playingAudio = !playbackManager.isPlayingVideo() && item !== null;
buttonVisible(context.querySelector('.btnRepeat'), playingAudio);
buttonVisible(context.querySelector('.btnShuffleQueue'), playingAudio);
buttonVisible(context.querySelector('.btnRewind'), playingVideo);
buttonVisible(context.querySelector('.btnFastForward'), playingVideo);
buttonVisible(context.querySelector('.nowPlayingSecondaryButtons .btnShuffleQueue'), playingVideo);
buttonVisible(context.querySelector('.nowPlayingSecondaryButtons .btnRepeat'), playingVideo);
} else {
buttonVisible(context.querySelector('.btnRewind'), item != null);
buttonVisible(context.querySelector('.btnFastForward'), item != null);

View File

@ -931,9 +931,9 @@ class ChromecastPlayer {
return state.VolumeLevel == null ? 100 : state.VolumeLevel;
}
isPlaying() {
isPlaying(mediaType) {
const state = this.lastPlayerData || {};
return state.NowPlayingItem != null;
return state.NowPlayingItem != null && (state.NowPlayingItem.MediaType === mediaType || !mediaType);
}
isPlayingVideo() {

View File

@ -466,9 +466,9 @@ class SessionPlayer {
sendCommandByName(this, 'DisplayContent', options);
}
isPlaying() {
isPlaying(mediaType) {
const state = this.lastPlayerData || {};
return state.NowPlayingItem != null;
return state.NowPlayingItem != null && (state.NowPlayingItem.MediaType === mediaType || !mediaType);
}
isPlayingVideo() {