mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
create localStorage abstraction
This commit is contained in:
parent
271261a093
commit
4ef1a70fc5
@ -1,5 +1,4 @@
|
||||
using MediaBrowser.Api.Playback.Hls;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
|
@ -342,7 +342,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
AppendPlaylist(builder, playlistUrl, totalBitrate);
|
||||
|
||||
if (state.VideoRequest.VideoBitRate.HasValue)
|
||||
if (EnableAdaptiveBitrateStreaming(state))
|
||||
{
|
||||
var requestedVideoBitrate = state.VideoRequest.VideoBitRate.Value;
|
||||
|
||||
@ -360,6 +360,17 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private bool EnableAdaptiveBitrateStreaming(StreamState state)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(state.MediaPath))
|
||||
{
|
||||
// Opening live streams is so slow it's not even worth it
|
||||
return false;
|
||||
}
|
||||
|
||||
return state.VideoRequest.VideoBitRate.HasValue;
|
||||
}
|
||||
|
||||
private void AppendPlaylist(StringBuilder builder, string url, int bitrate)
|
||||
{
|
||||
builder.AppendLine("#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=" + bitrate.ToString(UsCulture));
|
||||
@ -368,8 +379,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
|
||||
private int GetBitrateVariation(int bitrate)
|
||||
{
|
||||
// By default, vary by just 200k
|
||||
var variation = 200000;
|
||||
// By default, vary by just 100k
|
||||
var variation = 100000;
|
||||
|
||||
if (bitrate >= 10000000)
|
||||
{
|
||||
@ -391,6 +402,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||
{
|
||||
variation = 300000;
|
||||
}
|
||||
else if (bitrate >= 600000)
|
||||
{
|
||||
variation = 200000;
|
||||
}
|
||||
|
||||
return variation;
|
||||
}
|
||||
|
@ -426,9 +426,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
var files = new[]
|
||||
{
|
||||
"scripts/all.js" + versionString,
|
||||
"thirdparty/jstree1.0/jquery.jstree.min.js",
|
||||
"thirdparty/jquery.unveil-custom.js",
|
||||
"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"
|
||||
"thirdparty/jstree1.0/jquery.jstree.min.js"
|
||||
};
|
||||
|
||||
var tags = files.Select(s => string.Format("<script src=\"{0}\"></script>", s)).ToArray();
|
||||
@ -451,6 +449,9 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
await AppendResource(memoryStream, "thirdparty/jquery-2.0.3.min.js", newLineBytes).ConfigureAwait(false);
|
||||
await AppendResource(memoryStream, "thirdparty/jquerymobile-1.4.3/jquery.mobile-1.4.3.min.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
await AppendResource(memoryStream, "thirdparty/jquery.unveil-custom.js", newLineBytes).ConfigureAwait(false);
|
||||
await AppendResource(memoryStream, "thirdparty/cast_sender.js", newLineBytes).ConfigureAwait(false);
|
||||
|
||||
await AppendLocalization(memoryStream).ConfigureAwait(false);
|
||||
await memoryStream.WriteAsync(newLineBytes, 0, newLineBytes.Length).ConfigureAwait(false);
|
||||
|
||||
@ -585,8 +586,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||
"livetvstatus.js",
|
||||
"livetvtimers.js",
|
||||
|
||||
"localsettings.js",
|
||||
|
||||
"loginpage.js",
|
||||
"logpage.js",
|
||||
"medialibrarypage.js",
|
||||
|
@ -278,9 +278,6 @@
|
||||
<Content Include="dashboard-ui\css\images\media\play.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\tvflyout.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\librarymenu.css">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -461,21 +458,9 @@
|
||||
<Content Include="dashboard-ui\css\images\items\searchhintsv2\tv.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\audioflyout.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\chapterflyout.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\qualityflyout.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\selected.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\media\subtitleflyout.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\css\images\rotten.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -674,9 +659,6 @@
|
||||
<Content Include="dashboard-ui\scripts\librarypathmapping.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\localsettings.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\metadatachapters.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@ -806,6 +788,9 @@
|
||||
<Content Include="dashboard-ui\serversecurity.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\cast_sender.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\thirdparty\jquery-2.0.3.min.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
Loading…
Reference in New Issue
Block a user