fixes #564 - Enforce CanSeek and QueueableMediaTypes

This commit is contained in:
Luke Pulverenti 2013-10-11 09:47:38 -04:00
parent 204f7f6879
commit 3cb57db7fe
4 changed files with 23 additions and 8 deletions

View File

@ -182,7 +182,8 @@ namespace MediaBrowser.Api
if (job.ActiveRequestCount == 0) if (job.ActiveRequestCount == 0)
{ {
var timerDuration = type == TranscodingJobType.Progressive ? 1000 : 180000; // The HLS kill timer is long - 1/2 hr. clients should use the manual kill command when stopping.
var timerDuration = type == TranscodingJobType.Progressive ? 1000 : 1800000;
if (job.KillTimer == null) if (job.KillTimer == null)
{ {

View File

@ -224,13 +224,6 @@ namespace MediaBrowser.Api.UserLibrary
[Api(Description = "Reports that a user has begun playing an item")] [Api(Description = "Reports that a user has begun playing an item")]
public class OnPlaybackStart : IReturnVoid public class OnPlaybackStart : IReturnVoid
{ {
public OnPlaybackStart()
{
// Have to default these until all clients have a chance to incorporate them
CanSeek = true;
QueueableMediaTypes = "Audio,Video,Book,Game";
}
/// <summary> /// <summary>
/// Gets or sets the user id. /// Gets or sets the user id.
/// </summary> /// </summary>

View File

@ -38,6 +38,8 @@ namespace MediaBrowser.Server.Implementations.Session
/// </summary> /// </summary>
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
/// <summary> /// <summary>
/// Gets or sets the configuration manager. /// Gets or sets the configuration manager.
/// </summary> /// </summary>
@ -471,6 +473,19 @@ namespace MediaBrowser.Server.Implementations.Session
{ {
var session = GetSessionForRemoteControl(sessionId); var session = GetSessionForRemoteControl(sessionId);
if (command.PlayCommand != PlayCommand.PlayNow)
{
if (command.ItemIds.Any(i =>
{
var item = _libraryManager.GetItemById(new Guid(i));
return !session.QueueableMediaTypes.Contains(item.MediaType, StringComparer.OrdinalIgnoreCase);
}))
{
throw new ArgumentException(string.Format("Session {0} is unable to queue the requested media type.", session.Id));
}
}
return session.SessionController.SendPlayCommand(command, cancellationToken); return session.SessionController.SendPlayCommand(command, cancellationToken);
} }
@ -499,6 +514,11 @@ namespace MediaBrowser.Server.Implementations.Session
{ {
var session = GetSessionForRemoteControl(sessionId); var session = GetSessionForRemoteControl(sessionId);
if (command.Command == PlaystateCommand.Seek && !session.CanSeek)
{
throw new ArgumentException(string.Format("Session {0} is unable to seek.", session.Id));
}
return session.SessionController.SendPlaystateCommand(command, cancellationToken); return session.SessionController.SendPlaystateCommand(command, cancellationToken);
} }

View File

@ -374,6 +374,7 @@ namespace MediaBrowser.WebDashboard.Api
sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">"); sb.Append("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\">");
sb.Append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">"); sb.Append("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">");
sb.Append("<meta http-equiv=\"X-UA-Compatibility\" content=\"IE=Edge\">");
//sb.Append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\">"); //sb.Append("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\">");
// http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html // http://developer.apple.com/library/ios/#DOCUMENTATION/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html