mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-05 06:35:13 -04:00
update playback progress reporting
This commit is contained in:
parent
561028c907
commit
eb9b63c7a7
@ -318,8 +318,7 @@ namespace Emby.Dlna.PlayTo
|
|||||||
|
|
||||||
CanSeek = info.MediaSource == null ? _device.Duration.HasValue : info.MediaSource.RunTimeTicks.HasValue,
|
CanSeek = info.MediaSource == null ? _device.Duration.HasValue : info.MediaSource.RunTimeTicks.HasValue,
|
||||||
|
|
||||||
PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode,
|
PlayMethod = info.IsDirectStream ? PlayMethod.DirectStream : PlayMethod.Transcode
|
||||||
QueueableMediaTypes = new List<string> { mediaInfo.MediaType }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -612,8 +612,7 @@ namespace Emby.Server.Implementations.Session
|
|||||||
ClearTranscodingInfo(session.DeviceId);
|
ClearTranscodingInfo(session.DeviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
session.StopAutomaticProgress();
|
session.StartAutomaticProgress(_timerFactory, info);
|
||||||
session.QueueableMediaTypes = info.QueueableMediaTypes;
|
|
||||||
|
|
||||||
var users = GetUsers(session);
|
var users = GetUsers(session);
|
||||||
|
|
||||||
@ -720,7 +719,11 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
}, _logger);
|
}, _logger);
|
||||||
|
|
||||||
|
if (!isAutomated)
|
||||||
|
{
|
||||||
session.StartAutomaticProgress(_timerFactory, info);
|
session.StartAutomaticProgress(_timerFactory, info);
|
||||||
|
}
|
||||||
|
|
||||||
StartIdleCheckTimer();
|
StartIdleCheckTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1005,20 +1008,10 @@ namespace Emby.Server.Implementations.Session
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.PlayCommand != PlayCommand.PlayNow)
|
|
||||||
{
|
|
||||||
if (items.Any(i => !session.QueueableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
|
||||||
{
|
|
||||||
throw new ArgumentException(string.Format("{0} is unable to queue the requested media type.", session.DeviceName ?? session.Id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (items.Any(i => !session.PlayableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
if (items.Any(i => !session.PlayableMediaTypes.Contains(i.MediaType, StringComparer.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
throw new ArgumentException(string.Format("{0} is unable to play the requested media type.", session.DeviceName ?? session.Id));
|
throw new ArgumentException(string.Format("{0} is unable to play the requested media type.", session.DeviceName ?? session.Id));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (user != null && command.ItemIds.Length == 1 && user.Configuration.EnableNextEpisodeAutoPlay)
|
if (user != null && command.ItemIds.Length == 1 && user.Configuration.EnableNextEpisodeAutoPlay)
|
||||||
{
|
{
|
||||||
@ -1597,7 +1590,6 @@ namespace Emby.Server.Implementations.Session
|
|||||||
LastActivityDate = session.LastActivityDate,
|
LastActivityDate = session.LastActivityDate,
|
||||||
NowViewingItem = session.NowViewingItem,
|
NowViewingItem = session.NowViewingItem,
|
||||||
ApplicationVersion = session.ApplicationVersion,
|
ApplicationVersion = session.ApplicationVersion,
|
||||||
QueueableMediaTypes = session.QueueableMediaTypes,
|
|
||||||
PlayableMediaTypes = session.PlayableMediaTypes,
|
PlayableMediaTypes = session.PlayableMediaTypes,
|
||||||
AdditionalUsers = session.AdditionalUsers,
|
AdditionalUsers = session.AdditionalUsers,
|
||||||
SupportedCommands = session.SupportedCommands,
|
SupportedCommands = session.SupportedCommands,
|
||||||
|
@ -289,7 +289,6 @@ namespace Emby.Server.Implementations.Session
|
|||||||
|
|
||||||
var itemId = vals[0];
|
var itemId = vals[0];
|
||||||
|
|
||||||
var queueableMediaTypes = string.Empty;
|
|
||||||
var canSeek = true;
|
var canSeek = true;
|
||||||
|
|
||||||
if (vals.Length > 1)
|
if (vals.Length > 1)
|
||||||
@ -298,15 +297,14 @@ namespace Emby.Server.Implementations.Session
|
|||||||
}
|
}
|
||||||
if (vals.Length > 2)
|
if (vals.Length > 2)
|
||||||
{
|
{
|
||||||
queueableMediaTypes = vals[2];
|
// vals[2] used to be QueueableMediaTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = new PlaybackStartInfo
|
var info = new PlaybackStartInfo
|
||||||
{
|
{
|
||||||
CanSeek = canSeek,
|
CanSeek = canSeek,
|
||||||
ItemId = itemId,
|
ItemId = itemId,
|
||||||
SessionId = session.Id,
|
SessionId = session.Id
|
||||||
QueueableMediaTypes = queueableMediaTypes.Split(',').ToList()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (vals.Length > 3)
|
if (vals.Length > 3)
|
||||||
|
@ -109,13 +109,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
[ApiMember(Name = "CanSeek", Description = "Indicates if the client can seek", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "CanSeek", Description = "Indicates if the client can seek", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "POST")]
|
||||||
public bool CanSeek { get; set; }
|
public bool CanSeek { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the id.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The id.</value>
|
|
||||||
[ApiMember(Name = "QueueableMediaTypes", Description = "A list of media types that can be queued from this item, comma delimited. Audio,Video,Book,Game", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST", AllowMultiple = true)]
|
|
||||||
public string QueueableMediaTypes { get; set; }
|
|
||||||
|
|
||||||
[ApiMember(Name = "AudioStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
|
[ApiMember(Name = "AudioStreamIndex", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
|
||||||
public int? AudioStreamIndex { get; set; }
|
public int? AudioStreamIndex { get; set; }
|
||||||
|
|
||||||
@ -292,13 +285,10 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Post(OnPlaybackStart request)
|
public void Post(OnPlaybackStart request)
|
||||||
{
|
{
|
||||||
var queueableMediaTypes = request.QueueableMediaTypes ?? string.Empty;
|
|
||||||
|
|
||||||
Post(new ReportPlaybackStart
|
Post(new ReportPlaybackStart
|
||||||
{
|
{
|
||||||
CanSeek = request.CanSeek,
|
CanSeek = request.CanSeek,
|
||||||
ItemId = request.Id,
|
ItemId = request.Id,
|
||||||
QueueableMediaTypes = queueableMediaTypes.Split(',').ToList(),
|
|
||||||
MediaSourceId = request.MediaSourceId,
|
MediaSourceId = request.MediaSourceId,
|
||||||
AudioStreamIndex = request.AudioStreamIndex,
|
AudioStreamIndex = request.AudioStreamIndex,
|
||||||
SubtitleStreamIndex = request.SubtitleStreamIndex,
|
SubtitleStreamIndex = request.SubtitleStreamIndex,
|
||||||
|
@ -21,7 +21,6 @@ namespace MediaBrowser.Controller.Session
|
|||||||
{
|
{
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
QueueableMediaTypes = new List<string>();
|
|
||||||
|
|
||||||
AdditionalUsers = new List<SessionUserInfo>();
|
AdditionalUsers = new List<SessionUserInfo>();
|
||||||
PlayState = new PlayerStateInfo();
|
PlayState = new PlayerStateInfo();
|
||||||
@ -39,12 +38,6 @@ namespace MediaBrowser.Controller.Session
|
|||||||
/// <value>The remote end point.</value>
|
/// <value>The remote end point.</value>
|
||||||
public string RemoteEndPoint { get; set; }
|
public string RemoteEndPoint { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the queueable media types.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The queueable media types.</value>
|
|
||||||
public List<string> QueueableMediaTypes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the playable media types.
|
/// Gets or sets the playable media types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -214,13 +207,15 @@ namespace MediaBrowser.Controller.Session
|
|||||||
{
|
{
|
||||||
_lastProgressInfo = progressInfo;
|
_lastProgressInfo = progressInfo;
|
||||||
|
|
||||||
if (_progressTimer != null)
|
if (_progressTimer == null)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000);
|
_progressTimer = timerFactory.Create(OnProgressTimerCallback, null, 1000, 1000);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_progressTimer.Change(1000, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 second
|
// 1 second
|
||||||
@ -237,10 +232,11 @@ namespace MediaBrowser.Controller.Session
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var positionTicks = progressInfo.PositionTicks ?? 0;
|
var positionTicks = progressInfo.PositionTicks ?? 0;
|
||||||
if (positionTicks <= 0)
|
if (positionTicks < 0)
|
||||||
{
|
{
|
||||||
return;
|
positionTicks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newPositionTicks = positionTicks + ProgressIncrement;
|
var newPositionTicks = positionTicks + ProgressIncrement;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Session
|
namespace MediaBrowser.Model.Session
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -7,15 +6,5 @@ namespace MediaBrowser.Model.Session
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlaybackStartInfo : PlaybackProgressInfo
|
public class PlaybackStartInfo : PlaybackProgressInfo
|
||||||
{
|
{
|
||||||
public PlaybackStartInfo()
|
|
||||||
{
|
|
||||||
QueueableMediaTypes = new List<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the queueable media types.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The queueable media types.</value>
|
|
||||||
public List<string> QueueableMediaTypes { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,6 @@ namespace MediaBrowser.Model.Session
|
|||||||
/// <value>The supported commands.</value>
|
/// <value>The supported commands.</value>
|
||||||
public List<string> SupportedCommands { get; set; }
|
public List<string> SupportedCommands { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the queueable media types.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The queueable media types.</value>
|
|
||||||
public List<string> QueueableMediaTypes { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the playable media types.
|
/// Gets or sets the playable media types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -119,7 +113,6 @@ namespace MediaBrowser.Model.Session
|
|||||||
AdditionalUsers = new List<SessionUserInfo>();
|
AdditionalUsers = new List<SessionUserInfo>();
|
||||||
|
|
||||||
PlayableMediaTypes = new List<string>();
|
PlayableMediaTypes = new List<string>();
|
||||||
QueueableMediaTypes = new List<string>();
|
|
||||||
SupportedCommands = new List<string>();
|
SupportedCommands = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user