update video osd

This commit is contained in:
Luke Pulverenti 2017-01-04 03:02:08 -05:00
parent 7d8f6339a2
commit 5fb6288ba2
5 changed files with 55 additions and 27 deletions

View File

@ -14,12 +14,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.4.439",
"_release": "1.4.439",
"version": "1.4.441",
"_release": "1.4.441",
"_resolution": {
"type": "version",
"tag": "1.4.439",
"commit": "83d5b3f38e168da5f42415f346c8d624fc8523e8"
"tag": "1.4.441",
"commit": "f887007409e0ab3a8ca1f5b2a58aac519fc2c5cc"
},
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "^1.2.1",

View File

@ -191,6 +191,7 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
"SetVolume",
"SetAudioStreamIndex",
"SetSubtitleStreamIndex",
"SetMaxStreamingBitrate",
"DisplayContent",
"GoToSearch",
"DisplayMessage",
@ -376,6 +377,9 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
case 'SetSubtitleStreamIndex':
self.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index), player);
break;
case 'SetMaxStreamingBitrate':
self.setMaxStreamingBitrate(parseInt(cmd.Arguments.Bitrate), player);
break;
case 'ToggleFullscreen':
self.toggleFullscreen(player);
break;
@ -639,6 +643,36 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
}
};
self.getMaxStreamingBitrate = function (player) {
player = player || currentPlayer;
if (player && !enableLocalPlaylistManagement(player)) {
return player.getMaxStreamingBitrate();
}
return getPlayerData(player).maxStreamingBitrate || appSettings.maxStreamingBitrate();
};
self.setMaxStreamingBitrate = function (bitrate, player) {
player = player || currentPlayer;
if (player && !enableLocalPlaylistManagement(player)) {
return player.setMaxStreamingBitrate(bitrate);
}
if (bitrate) {
appSettings.enableAutomaticBitrateDetection(false);
} else {
appSettings.enableAutomaticBitrateDetection(true);
}
appSettings.maxStreamingBitrate(bitrate);
changeStream(player, getCurrentTicks(player), {
MaxStreamingBitrate: bitrate
});
};
self.getSubtitleStreamIndex = function (player) {
player = player || currentPlayer;
@ -893,8 +927,6 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
params = params || {};
var currentSrc = player.currentSrc();
var liveStreamId = getPlayerData(player).streamInfo.liveStreamId;
var playSessionId = getPlayerData(player).streamInfo.playSessionId;
@ -913,7 +945,9 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
ticks = parseInt(ticks);
}
getPlaybackInfo(apiClient, currentItem.Id, deviceProfile, appSettings.maxStreamingBitrate(), ticks, currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
var maxBitrate = params.MaxStreamingBitrate || self.getMaxStreamingBitrate(player);
getPlaybackInfo(apiClient, currentItem.Id, deviceProfile, maxBitrate, ticks, currentMediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
if (validatePlaybackInfoResult(result)) {
@ -930,6 +964,7 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
getPlayerData(player).subtitleStreamIndex = subtitleStreamIndex;
getPlayerData(player).audioStreamIndex = audioStreamIndex;
getPlayerData(player).maxStreamingBitrate = maxBitrate;
changeStreamToUrl(apiClient, player, playSessionId, streamInfo);
});
@ -1536,6 +1571,7 @@ define(['events', 'datetime', 'appSettings', 'pluginManager', 'userSettings', 'g
streamInfo.fullscreen = playOptions.fullscreen;
getPlayerData(player).isChangingStream = false;
getPlayerData(player).maxStreamingBitrate = maxBitrate;
return player.play(streamInfo).then(function () {
onPlaybackStarted(player, streamInfo, mediaSource);

View File

@ -36,7 +36,7 @@
options.push({ name: '720p - 6Mbps', maxHeight: 720, bitrate: 6000000 });
options.push({ name: '720p - 5Mbps', maxHeight: 720, bitrate: 5000000 });
} else if (maxAllowedWidth >= 700) {
} else if (maxAllowedWidth >= 620) {
options.push({ name: '480p - 4Mbps', maxHeight: 480, bitrate: 4000001 });
options.push({ name: '480p - 3Mbps', maxHeight: 480, bitrate: 3000001 });
options.push({ name: '480p - 2.5Mbps', maxHeight: 480, bitrate: 2500000 });

View File

@ -87,9 +87,7 @@
var currentPlayerSupportedCommands = [];
var currentRuntimeTicks = 0;
var lastUpdateTime = 0;
var lastPlayerState = {};
var isEnabled;
var currentItem;
var nowPlayingVolumeSlider = view.querySelector('.osdVolumeSlider');
var nowPlayingVolumeSliderContainer = view.querySelector('.osdVolumeSliderContainer');
@ -486,6 +484,8 @@
function onPlaybackStopped(e, state) {
currentRuntimeTicks = null;
console.log('nowplaying event: ' + e.type);
var player = this;
@ -559,8 +559,6 @@
lastUpdateTime = now;
var player = this;
var state = lastPlayerState;
var nowPlayingItem = state.NowPlayingItem || {};
currentRuntimeTicks = playbackManager.duration(player);
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks);
}
@ -576,8 +574,6 @@
function updatePlayerStateInternal(event, state) {
lastPlayerState = state;
var playerInfo = playbackManager.getPlayerInfo();
var playState = state.PlayState || {};
@ -619,7 +615,7 @@
updateNowPlayingInfo(state);
if (state.MediaSource && state.MediaSource.SupportsTranscoding) {
if (state.MediaSource && state.MediaSource.SupportsTranscoding && supportedCommands.indexOf('SetMaxStreamingBitrate') !== -1) {
view.querySelector('.btnSettings').classList.remove('hide');
} else {
view.querySelector('.btnSettings').classList.add('hide');
@ -750,12 +746,12 @@
//var currentSrc = self.getCurrentSrc(self.currentMediaRenderer).toLowerCase();
//var isStatic = currentSrc.indexOf('static=true') != -1;
var videoStream = lastPlayerState.MediaSource.MediaStreams.filter(function (stream) {
return stream.Type == "Video";
var videoStream = playbackManager.currentMediaSource(currentPlayer).MediaStreams.filter(function (stream) {
return stream.Type === "Video";
})[0];
var videoWidth = videoStream ? videoStream.Width : null;
var options = qualityoptions.getVideoQualityOptions(lastPlayerState.MaxStreamingBitrate, videoWidth);
var options = qualityoptions.getVideoQualityOptions(playbackManager.getMaxStreamingBitrate(currentPlayer), videoWidth);
//if (isStatic) {
// options[0].name = "Direct";
@ -781,14 +777,12 @@
selectedId = selectedId.length ? selectedId[0].bitrate : null;
actionsheet.show({
items: menuItems,
// history.back() will cause the video player to stop
enableHistory: false,
positionTo: btn,
callback: function (id) {
var bitrate = parseInt(id);
if (bitrate != selectedId) {
//self.onQualityOptionSelected(bitrate);
if (bitrate !== selectedId) {
playbackManager.setMaxStreamingBitrate(bitrate, currentPlayer);
}
}
});
@ -930,9 +924,7 @@
nowPlayingPositionSlider.getBubbleText = function (value) {
var state = lastPlayerState;
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
if (!currentRuntimeTicks) {
return '--:--';
}
@ -1007,7 +999,7 @@
function renderScenePicker(progressPct) {
chapterPcts = [];
var item = currentItem;
var item = playbackManager.currentItem(currentPlayer);
if (!item) {
return;
}

View File

@ -208,7 +208,7 @@
<i class="xlargePaperIconButton md-icon">&#xE307;</i>
</button>
<button is="paper-icon-button-light" class="btnSettings hide autoSize">
<i class="xlargePaperIconButton md-icon">&#xE8B8;</i>
<i class="largePaperIconButton md-icon">&#xE8B8;</i>
</button>
<div class="osdTimeText"><span class="osdPositionText"></span><span class="osdDurationText"></span><span class="endsAtText"></span></div>