mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
consolidate datetime methods
This commit is contained in:
parent
8225003fd5
commit
7b625ade86
9 changed files with 231 additions and 278 deletions
|
@ -1,4 +1,4 @@
|
||||||
define(['browser', 'jQuery', 'paper-fab', 'paper-tabs', 'paper-slider', 'paper-icon-button'], function (browser, $) {
|
define(['browser', 'datetime', 'jQuery', 'paper-fab', 'paper-tabs', 'paper-slider', 'paper-icon-button'], function (browser, datetime, $) {
|
||||||
|
|
||||||
function showSlideshowMenu(context) {
|
function showSlideshowMenu(context) {
|
||||||
require(['scripts/slideshow'], function () {
|
require(['scripts/slideshow'], function () {
|
||||||
|
@ -343,11 +343,11 @@
|
||||||
if (playState.PositionTicks == null) {
|
if (playState.PositionTicks == null) {
|
||||||
context.querySelector('.positionTime').innerHTML = '--:--';
|
context.querySelector('.positionTime').innerHTML = '--:--';
|
||||||
} else {
|
} else {
|
||||||
context.querySelector('.positionTime').innerHTML = Dashboard.getDisplayTime(playState.PositionTicks);
|
context.querySelector('.positionTime').innerHTML = datetime.getDisplayRunningTime(playState.PositionTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item && item.RunTimeTicks != null) {
|
if (item && item.RunTimeTicks != null) {
|
||||||
context.querySelector('.runtime').innerHTML = Dashboard.getDisplayTime(item.RunTimeTicks);
|
context.querySelector('.runtime').innerHTML = datetime.getDisplayRunningTime(item.RunTimeTicks);
|
||||||
} else {
|
} else {
|
||||||
context.querySelector('.runtime').innerHTML = '--:--';
|
context.querySelector('.runtime').innerHTML = '--:--';
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@
|
||||||
ticks /= 100;
|
ticks /= 100;
|
||||||
ticks *= value;
|
ticks *= value;
|
||||||
|
|
||||||
this.pinValue = Dashboard.getDisplayTime(ticks);
|
this.pinValue = datetime.getDisplayRunningTime(ticks);
|
||||||
};
|
};
|
||||||
|
|
||||||
context.addEventListener('click', onContextClick);
|
context.addEventListener('click', onContextClick);
|
||||||
|
|
|
@ -411,7 +411,7 @@
|
||||||
|
|
||||||
if (session.TranscodingInfo && session.TranscodingInfo.Framerate) {
|
if (session.TranscodingInfo && session.TranscodingInfo.Framerate) {
|
||||||
|
|
||||||
html += ' - '+session.TranscodingInfo.Framerate + ' fps';
|
html += ' - ' + session.TranscodingInfo.Framerate + ' fps';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (session.PlayState.PlayMethod == 'DirectStream') {
|
else if (session.PlayState.PlayMethod == 'DirectStream') {
|
||||||
|
@ -465,7 +465,7 @@
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
if (session.PlayState.PositionTicks) {
|
if (session.PlayState.PositionTicks) {
|
||||||
html += Dashboard.getDisplayTime(session.PlayState.PositionTicks);
|
html += datetime.getDisplayRunningTime(session.PlayState.PositionTicks);
|
||||||
} else {
|
} else {
|
||||||
html += '--:--:--';
|
html += '--:--:--';
|
||||||
}
|
}
|
||||||
|
@ -475,7 +475,7 @@
|
||||||
var nowPlayingItem = session.NowPlayingItem;
|
var nowPlayingItem = session.NowPlayingItem;
|
||||||
|
|
||||||
if (nowPlayingItem && nowPlayingItem.RunTimeTicks) {
|
if (nowPlayingItem && nowPlayingItem.RunTimeTicks) {
|
||||||
html += Dashboard.getDisplayTime(nowPlayingItem.RunTimeTicks);
|
html += datetime.getDisplayRunningTime(nowPlayingItem.RunTimeTicks);
|
||||||
} else {
|
} else {
|
||||||
html += '--:--:--';
|
html += '--:--:--';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['appSettings', 'jQuery', 'paper-slider', 'paper-button'], function (appSettings, $) {
|
define(['appSettings', 'datetime', 'jQuery', 'paper-slider', 'paper-button'], function (appSettings, datetime, $) {
|
||||||
|
|
||||||
function getDeviceProfile(serverAddress, deviceId, item, startPositionTicks, maxBitrate, mediaSourceId, audioStreamIndex, subtitleStreamIndex) {
|
function getDeviceProfile(serverAddress, deviceId, item, startPositionTicks, maxBitrate, mediaSourceId, audioStreamIndex, subtitleStreamIndex) {
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@
|
||||||
|
|
||||||
var time = item.RunTimeTicks * (Number(pct) * .01);
|
var time = item.RunTimeTicks * (Number(pct) * .01);
|
||||||
|
|
||||||
var tooltext = Dashboard.getDisplayTime(time);
|
var tooltext = datetime.getDisplayRunningTime(time);
|
||||||
|
|
||||||
$('.sliderValue', elem).html(tooltext);
|
$('.sliderValue', elem).html(tooltext);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['layoutManager', 'jQuery', 'scrollStyles'], function (layoutManager, $) {
|
define(['layoutManager', 'datetime', 'jQuery', 'scrollStyles'], function (layoutManager, datetime, $) {
|
||||||
|
|
||||||
var currentItem;
|
var currentItem;
|
||||||
|
|
||||||
|
@ -1402,7 +1402,7 @@
|
||||||
html += '<div class="cardFooter">';
|
html += '<div class="cardFooter">';
|
||||||
html += '<div class="cardText">' + chapterName + '</div>';
|
html += '<div class="cardText">' + chapterName + '</div>';
|
||||||
html += '<div class="cardText">';
|
html += '<div class="cardText">';
|
||||||
html += Dashboard.getDisplayTime(chapter.StartPositionTicks);
|
html += datetime.getDisplayRunningTime(chapter.StartPositionTicks);
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
//cardFooter
|
//cardFooter
|
||||||
|
@ -1639,7 +1639,7 @@
|
||||||
html += '<div class="cardText">' + item.Name + '</div>';
|
html += '<div class="cardText">' + item.Name + '</div>';
|
||||||
html += '<div class="cardText">';
|
html += '<div class="cardText">';
|
||||||
if (item.RunTimeTicks != "") {
|
if (item.RunTimeTicks != "") {
|
||||||
html += Dashboard.getDisplayTime(item.RunTimeTicks);
|
html += datetime.getDisplayRunningTime(item.RunTimeTicks);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += " ";
|
html += " ";
|
||||||
|
|
|
@ -3525,7 +3525,7 @@
|
||||||
|
|
||||||
if (item.Type == "Audio") {
|
if (item.Type == "Audio") {
|
||||||
|
|
||||||
miscInfo.push(Dashboard.getDisplayTime(item.RunTimeTicks));
|
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
minutes = item.RunTimeTicks / 600000000;
|
minutes = item.RunTimeTicks / 600000000;
|
||||||
|
@ -3538,7 +3538,7 @@
|
||||||
|
|
||||||
if (item.CumulativeRunTimeTicks && item.Type != "Series" && item.Type != "Season") {
|
if (item.CumulativeRunTimeTicks && item.Type != "Series" && item.Type != "Season") {
|
||||||
|
|
||||||
miscInfo.push(Dashboard.getDisplayTime(item.CumulativeRunTimeTicks));
|
miscInfo.push(datetime.getDisplayRunningTime(item.CumulativeRunTimeTicks));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.OfficialRating && item.Type !== "Season" && item.Type !== "Episode") {
|
if (item.OfficialRating && item.Type !== "Season" && item.Type !== "Episode") {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['appSettings', 'jQuery', 'scrollStyles'], function (appSettings, $) {
|
define(['appSettings', 'datetime', 'jQuery', 'scrollStyles'], function (appSettings, datetime, $) {
|
||||||
|
|
||||||
function createVideoPlayer(self) {
|
function createVideoPlayer(self) {
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@
|
||||||
if (c.Name) {
|
if (c.Name) {
|
||||||
chapterHtml += '<div class="cardText">' + c.Name + '</div>';
|
chapterHtml += '<div class="cardText">' + c.Name + '</div>';
|
||||||
}
|
}
|
||||||
chapterHtml += '<div class="cardText">' + Dashboard.getDisplayTime(c.StartPositionTicks) + '</div>';
|
chapterHtml += '<div class="cardText">' + datetime.getDisplayRunningTime(c.StartPositionTicks) + '</div>';
|
||||||
chapterHtml += '</div>';
|
chapterHtml += '</div>';
|
||||||
chapterHtml += '</div>';
|
chapterHtml += '</div>';
|
||||||
|
|
||||||
|
@ -789,7 +789,7 @@
|
||||||
ticks /= 100;
|
ticks /= 100;
|
||||||
ticks *= value;
|
ticks *= value;
|
||||||
|
|
||||||
this.pinValue = Dashboard.getDisplayTime(ticks);
|
this.pinValue = datetime.getDisplayRunningTime(ticks);
|
||||||
};
|
};
|
||||||
|
|
||||||
volumeSlider = $('.videoVolumeSlider', parent).on('change', function () {
|
volumeSlider = $('.videoVolumeSlider', parent).on('change', function () {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, userSettings, appStorage) {
|
define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appSettings, userSettings, appStorage, datetime) {
|
||||||
|
|
||||||
function mediaPlayer() {
|
function mediaPlayer() {
|
||||||
|
|
||||||
|
@ -44,216 +44,6 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use
|
||||||
return targets;
|
return targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
function updateDeviceProfileForAndroid(profile) {
|
|
||||||
|
|
||||||
// Just here as an easy escape out, if ever needed
|
|
||||||
var enableVlcVideo = true;
|
|
||||||
var enableVlcAudio = window.VlcAudio;
|
|
||||||
|
|
||||||
if (enableVlcVideo) {
|
|
||||||
|
|
||||||
profile.DirectPlayProfiles.push({
|
|
||||||
Container: "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm",
|
|
||||||
Type: 'Video',
|
|
||||||
AudioCodec: 'aac,aac_latm,mp3,ac3,wma,dca,pcm,PCM_S16LE,PCM_S24LE,opus,flac'
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
|
|
||||||
return i.Type == 'Audio';
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.SubtitleProfiles = [];
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'srt',
|
|
||||||
Method: 'External'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'srt',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'subrip',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'ass',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'ssa',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'pgs',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'pgssub',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'dvdsub',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'vtt',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'sub',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'idx',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'smi',
|
|
||||||
Method: 'Embed'
|
|
||||||
});
|
|
||||||
|
|
||||||
// These don't play very well
|
|
||||||
profile.CodecProfiles.push({
|
|
||||||
Type: 'VideoAudio',
|
|
||||||
Codec: 'dca',
|
|
||||||
Conditions: [
|
|
||||||
{
|
|
||||||
Condition: 'LessThanEqual',
|
|
||||||
Property: 'AudioChannels',
|
|
||||||
Value: 6
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.CodecProfiles.push({
|
|
||||||
Type: 'VideoAudio',
|
|
||||||
Codec: 'aac,mp3',
|
|
||||||
Conditions: [
|
|
||||||
{
|
|
||||||
Condition: 'LessThanEqual',
|
|
||||||
Property: 'AudioChannels',
|
|
||||||
Value: '6'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.CodecProfiles.push({
|
|
||||||
Type: 'Video',
|
|
||||||
Codec: 'h264',
|
|
||||||
Conditions: [
|
|
||||||
{
|
|
||||||
Condition: 'EqualsAny',
|
|
||||||
Property: 'VideoProfile',
|
|
||||||
Value: 'high|main|baseline|constrained baseline'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Condition: 'LessThanEqual',
|
|
||||||
Property: 'VideoLevel',
|
|
||||||
Value: '41'
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.TranscodingProfiles.filter(function (p) {
|
|
||||||
|
|
||||||
return p.Type == 'Video' && p.CopyTimestamps == true;
|
|
||||||
|
|
||||||
}).forEach(function (p) {
|
|
||||||
|
|
||||||
// Vlc doesn't seem to handle this well
|
|
||||||
p.CopyTimestamps = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.TranscodingProfiles.filter(function (p) {
|
|
||||||
|
|
||||||
return p.Type == 'Video' && p.VideoCodec == 'h264';
|
|
||||||
|
|
||||||
}).forEach(function (p) {
|
|
||||||
|
|
||||||
p.AudioCodec += ',ac3';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enableVlcAudio) {
|
|
||||||
|
|
||||||
profile.DirectPlayProfiles.push({
|
|
||||||
Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus",
|
|
||||||
Type: 'Audio'
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
|
|
||||||
return i.Type != 'Audio';
|
|
||||||
});
|
|
||||||
|
|
||||||
profile.CodecProfiles.push({
|
|
||||||
Type: 'Audio',
|
|
||||||
Conditions: [{
|
|
||||||
Condition: 'LessThanEqual',
|
|
||||||
Property: 'AudioChannels',
|
|
||||||
Value: '2'
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateDeviceProfileForIOS(profile) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
self.getDeviceProfile = function (maxHeight) {
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
|
|
||||||
require(['browserdeviceprofile', 'qualityoptions'], function (profileBuilder, qualityoptions) {
|
|
||||||
|
|
||||||
var supportsCustomSeeking = false;
|
|
||||||
if (!browserInfo.mobile) {
|
|
||||||
supportsCustomSeeking = true;
|
|
||||||
} else if (AppInfo.isNativeApp && browserInfo.safari) {
|
|
||||||
if (navigator.userAgent.toLowerCase().indexOf('ipad') == -1) {
|
|
||||||
// Need to disable it in order to support picture in picture
|
|
||||||
supportsCustomSeeking = true;
|
|
||||||
}
|
|
||||||
} else if (AppInfo.isNativeApp) {
|
|
||||||
supportsCustomSeeking = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var profile = profileBuilder({
|
|
||||||
supportsCustomSeeking: supportsCustomSeeking
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!(AppInfo.isNativeApp && browserInfo.android)) {
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'ass',
|
|
||||||
Method: 'External'
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: 'ssa',
|
|
||||||
Method: 'External'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var bitrateSetting = appSettings.maxStreamingBitrate();
|
|
||||||
|
|
||||||
if (!maxHeight) {
|
|
||||||
maxHeight = qualityoptions.getVideoQualityOptions(bitrateSetting).filter(function (q) {
|
|
||||||
return q.selected;
|
|
||||||
})[0].maxHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (AppInfo.isNativeApp && browserInfo.android) {
|
|
||||||
updateDeviceProfileForAndroid(profile);
|
|
||||||
}
|
|
||||||
else if (AppInfo.isNativeApp && browserInfo.safari) {
|
|
||||||
updateDeviceProfileForIOS(profile);
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.MaxStreamingBitrate = bitrateSetting;
|
|
||||||
|
|
||||||
resolve(profile);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var supportsTextTracks;
|
var supportsTextTracks;
|
||||||
self.supportsTextTracks = function () {
|
self.supportsTextTracks = function () {
|
||||||
|
|
||||||
|
@ -378,7 +168,7 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use
|
||||||
var playSessionId = getParameterByName('PlaySessionId', currentSrc);
|
var playSessionId = getParameterByName('PlaySessionId', currentSrc);
|
||||||
var liveStreamId = getParameterByName('LiveStreamId', currentSrc);
|
var liveStreamId = getParameterByName('LiveStreamId', currentSrc);
|
||||||
|
|
||||||
self.getDeviceProfile().then(function (deviceProfile) {
|
Dashboard.getDeviceProfile().then(function (deviceProfile) {
|
||||||
|
|
||||||
var audioStreamIndex = params.AudioStreamIndex == null ? (getParameterByName('AudioStreamIndex', currentSrc) || null) : params.AudioStreamIndex;
|
var audioStreamIndex = params.AudioStreamIndex == null ? (getParameterByName('AudioStreamIndex', currentSrc) || null) : params.AudioStreamIndex;
|
||||||
if (typeof (audioStreamIndex) == 'string') {
|
if (typeof (audioStreamIndex) == 'string') {
|
||||||
|
@ -481,12 +271,12 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use
|
||||||
// Convert to ticks
|
// Convert to ticks
|
||||||
ticks = Math.floor(ticks);
|
ticks = Math.floor(ticks);
|
||||||
|
|
||||||
var timeText = Dashboard.getDisplayTime(ticks);
|
var timeText = datetime.getDisplayRunningTime(ticks);
|
||||||
var mediaRenderer = self.currentMediaRenderer;
|
var mediaRenderer = self.currentMediaRenderer;
|
||||||
|
|
||||||
if (self.currentDurationTicks) {
|
if (self.currentDurationTicks) {
|
||||||
|
|
||||||
timeText += " / " + Dashboard.getDisplayTime(self.currentDurationTicks);
|
timeText += " / " + datetime.getDisplayRunningTime(self.currentDurationTicks);
|
||||||
|
|
||||||
if (positionSlider) {
|
if (positionSlider) {
|
||||||
|
|
||||||
|
@ -864,7 +654,7 @@ define(['appSettings', 'userSettings', 'appStorage'], function (appSettings, use
|
||||||
}
|
}
|
||||||
|
|
||||||
var onBitrateDetected = function () {
|
var onBitrateDetected = function () {
|
||||||
self.getDeviceProfile().then(function (deviceProfile) {
|
Dashboard.getDeviceProfile().then(function (deviceProfile) {
|
||||||
playOnDeviceProfileCreated(deviceProfile, item, startPosition, callback);
|
playOnDeviceProfileCreated(deviceProfile, item, startPosition, callback);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['jQuery'], function ($) {
|
define(['datetime', 'jQuery'], function (datetime, $) {
|
||||||
|
|
||||||
var currentPlayer;
|
var currentPlayer;
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
ticks /= 100;
|
ticks /= 100;
|
||||||
ticks *= value;
|
ticks *= value;
|
||||||
|
|
||||||
this.pinValue = Dashboard.getDisplayTime(ticks);
|
this.pinValue = datetime.getDisplayRunningTime(ticks);
|
||||||
};
|
};
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
@ -375,11 +375,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeText = Dashboard.getDisplayTime(playState.PositionTicks);
|
var timeText = datetime.getDisplayRunningTime(playState.PositionTicks);
|
||||||
|
|
||||||
if (nowPlayingItem.RunTimeTicks) {
|
if (nowPlayingItem.RunTimeTicks) {
|
||||||
|
|
||||||
timeText += " / " + Dashboard.getDisplayTime(nowPlayingItem.RunTimeTicks);
|
timeText += " / " + datetime.getDisplayRunningTime(nowPlayingItem.RunTimeTicks);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1101,44 +1101,6 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getDisplayTime: function (ticks) {
|
|
||||||
|
|
||||||
var ticksPerHour = 36000000000;
|
|
||||||
var ticksPerMinute = 600000000;
|
|
||||||
var ticksPerSecond = 10000000;
|
|
||||||
|
|
||||||
var parts = [];
|
|
||||||
|
|
||||||
var hours = ticks / ticksPerHour;
|
|
||||||
hours = Math.floor(hours);
|
|
||||||
|
|
||||||
if (hours) {
|
|
||||||
parts.push(hours);
|
|
||||||
}
|
|
||||||
|
|
||||||
ticks -= (hours * ticksPerHour);
|
|
||||||
|
|
||||||
var minutes = ticks / ticksPerMinute;
|
|
||||||
minutes = Math.floor(minutes);
|
|
||||||
|
|
||||||
ticks -= (minutes * ticksPerMinute);
|
|
||||||
|
|
||||||
if (minutes < 10 && hours) {
|
|
||||||
minutes = '0' + minutes;
|
|
||||||
}
|
|
||||||
parts.push(minutes);
|
|
||||||
|
|
||||||
var seconds = ticks / ticksPerSecond;
|
|
||||||
seconds = Math.floor(seconds);
|
|
||||||
|
|
||||||
if (seconds < 10) {
|
|
||||||
seconds = '0' + seconds;
|
|
||||||
}
|
|
||||||
parts.push(seconds);
|
|
||||||
|
|
||||||
return parts.join(':');
|
|
||||||
},
|
|
||||||
|
|
||||||
getSupportedRemoteCommands: function () {
|
getSupportedRemoteCommands: function () {
|
||||||
|
|
||||||
// Full list
|
// Full list
|
||||||
|
@ -1249,6 +1211,209 @@ var Dashboard = {
|
||||||
|
|
||||||
exit: function () {
|
exit: function () {
|
||||||
Dashboard.logout();
|
Dashboard.logout();
|
||||||
|
},
|
||||||
|
|
||||||
|
getDeviceProfile: function (maxHeight) {
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
function updateDeviceProfileForAndroid(profile) {
|
||||||
|
|
||||||
|
// Just here as an easy escape out, if ever needed
|
||||||
|
var enableVlcVideo = true;
|
||||||
|
var enableVlcAudio = window.VlcAudio;
|
||||||
|
|
||||||
|
if (enableVlcVideo) {
|
||||||
|
|
||||||
|
profile.DirectPlayProfiles.push({
|
||||||
|
Container: "m4v,3gp,ts,mpegts,mov,xvid,vob,mkv,wmv,asf,ogm,ogv,m2v,avi,mpg,mpeg,mp4,webm",
|
||||||
|
Type: 'Video',
|
||||||
|
AudioCodec: 'aac,aac_latm,mp3,ac3,wma,dca,pcm,PCM_S16LE,PCM_S24LE,opus,flac'
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
|
||||||
|
return i.Type == 'Audio';
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.SubtitleProfiles = [];
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'srt',
|
||||||
|
Method: 'External'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'srt',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'subrip',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'ass',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'ssa',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'pgs',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'pgssub',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'dvdsub',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'vtt',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'sub',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'idx',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'smi',
|
||||||
|
Method: 'Embed'
|
||||||
|
});
|
||||||
|
|
||||||
|
// These don't play very well
|
||||||
|
profile.CodecProfiles.push({
|
||||||
|
Type: 'VideoAudio',
|
||||||
|
Codec: 'dca',
|
||||||
|
Conditions: [
|
||||||
|
{
|
||||||
|
Condition: 'LessThanEqual',
|
||||||
|
Property: 'AudioChannels',
|
||||||
|
Value: 6
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.CodecProfiles.push({
|
||||||
|
Type: 'VideoAudio',
|
||||||
|
Codec: 'aac,mp3',
|
||||||
|
Conditions: [
|
||||||
|
{
|
||||||
|
Condition: 'LessThanEqual',
|
||||||
|
Property: 'AudioChannels',
|
||||||
|
Value: '6'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.CodecProfiles.push({
|
||||||
|
Type: 'Video',
|
||||||
|
Codec: 'h264',
|
||||||
|
Conditions: [
|
||||||
|
{
|
||||||
|
Condition: 'EqualsAny',
|
||||||
|
Property: 'VideoProfile',
|
||||||
|
Value: 'high|main|baseline|constrained baseline'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Condition: 'LessThanEqual',
|
||||||
|
Property: 'VideoLevel',
|
||||||
|
Value: '41'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.TranscodingProfiles.filter(function (p) {
|
||||||
|
|
||||||
|
return p.Type == 'Video' && p.CopyTimestamps == true;
|
||||||
|
|
||||||
|
}).forEach(function (p) {
|
||||||
|
|
||||||
|
// Vlc doesn't seem to handle this well
|
||||||
|
p.CopyTimestamps = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.TranscodingProfiles.filter(function (p) {
|
||||||
|
|
||||||
|
return p.Type == 'Video' && p.VideoCodec == 'h264';
|
||||||
|
|
||||||
|
}).forEach(function (p) {
|
||||||
|
|
||||||
|
p.AudioCodec += ',ac3';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableVlcAudio) {
|
||||||
|
|
||||||
|
profile.DirectPlayProfiles.push({
|
||||||
|
Container: "aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus",
|
||||||
|
Type: 'Audio'
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.CodecProfiles = profile.CodecProfiles.filter(function (i) {
|
||||||
|
return i.Type != 'Audio';
|
||||||
|
});
|
||||||
|
|
||||||
|
profile.CodecProfiles.push({
|
||||||
|
Type: 'Audio',
|
||||||
|
Conditions: [{
|
||||||
|
Condition: 'LessThanEqual',
|
||||||
|
Property: 'AudioChannels',
|
||||||
|
Value: '2'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
require(['browserdeviceprofile', 'qualityoptions', 'appSettings'], function (profileBuilder, qualityoptions, appSettings) {
|
||||||
|
|
||||||
|
var supportsCustomSeeking = false;
|
||||||
|
if (!browserInfo.mobile) {
|
||||||
|
supportsCustomSeeking = true;
|
||||||
|
} else if (AppInfo.isNativeApp && browserInfo.safari) {
|
||||||
|
if (navigator.userAgent.toLowerCase().indexOf('ipad') == -1) {
|
||||||
|
// Need to disable it in order to support picture in picture
|
||||||
|
supportsCustomSeeking = true;
|
||||||
|
}
|
||||||
|
} else if (AppInfo.isNativeApp) {
|
||||||
|
supportsCustomSeeking = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var profile = profileBuilder({
|
||||||
|
supportsCustomSeeking: supportsCustomSeeking
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!(AppInfo.isNativeApp && browserInfo.android)) {
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'ass',
|
||||||
|
Method: 'External'
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: 'ssa',
|
||||||
|
Method: 'External'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitrateSetting = appSettings.maxStreamingBitrate();
|
||||||
|
|
||||||
|
if (!maxHeight) {
|
||||||
|
maxHeight = qualityoptions.getVideoQualityOptions(bitrateSetting).filter(function (q) {
|
||||||
|
return q.selected;
|
||||||
|
})[0].maxHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AppInfo.isNativeApp && browserInfo.android) {
|
||||||
|
updateDeviceProfileForAndroid(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.MaxStreamingBitrate = bitrateSetting;
|
||||||
|
|
||||||
|
resolve(profile);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1377,9 +1542,7 @@ var AppInfo = {};
|
||||||
|
|
||||||
function getSyncProfile() {
|
function getSyncProfile() {
|
||||||
|
|
||||||
return getRequirePromise(['scripts/mediaplayer']).then(function () {
|
return Dashboard.getDeviceProfile(Math.max(screen.height, screen.width));
|
||||||
return MediaPlayer.getDeviceProfile(Math.max(screen.height, screen.width));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onApiClientCreated(e, newApiClient) {
|
function onApiClientCreated(e, newApiClient) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue