Enable remote "fullscreen" command

This is really only pseudo-fullscreen, as the js fullscreen API doesn't
allow fullscreen without user interaction.
This commit is contained in:
Tim Hobbs 2014-03-20 12:12:10 -07:00
parent 436d10bef9
commit d5e49f590d
4 changed files with 38 additions and 2 deletions

View file

@ -131,7 +131,7 @@ namespace MediaBrowser.Api
/// Gets or sets the play command.
/// </summary>
/// <value>The play command.</value>
[ApiMember(Name = "Command", Description = "The command to send - stop, pause, unpause, nexttrack, previoustrack, seek.", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
[ApiMember(Name = "Command", Description = "The command to send - stop, pause, unpause, nexttrack, previoustrack, seek, fullscreen.", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public PlaystateCommand Command { get; set; }
}

View file

@ -30,6 +30,15 @@ namespace MediaBrowser.Dlna.PlayTo
}
}
private bool _fullscreen;
public bool IsFullscreen
{
get
{
return _fullscreen;
}
}
private string _currentId = String.Empty;
public string CurrentId
{
@ -207,6 +216,26 @@ namespace MediaBrowser.Dlna.PlayTo
return SetVolume(tmp);
}
public async Task<bool> ToggleFullscreen()
{
var command = RendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "Fullscreen");
if (command == null)
return true;
var service = Properties.Services.FirstOrDefault(s => s.ServiceType == ServiceRenderingType);
if (service == null) {
throw new InvalidOperationException("Unable to find service");
}
_fullscreen = !_fullscreen;
var result = await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, RendererCommands.BuildPost(command, service.ServiceType, _fullscreen))
.ConfigureAwait(false);
return true;
}
public async Task<bool> SetVolume(int value)
{
var command = RendererCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");

View file

@ -283,6 +283,9 @@ namespace MediaBrowser.Dlna.PlayTo
case PlaystateCommand.PreviousTrack:
_currentItem = null;
return SetPrevious();
case PlaystateCommand.Fullscreen:
return _device.ToggleFullscreen();
}
return Task.FromResult(true);

View file

@ -29,7 +29,11 @@ namespace MediaBrowser.Model.Session
/// <summary>
/// The seek
/// </summary>
Seek
Seek,
/// <summary>
/// The fullscreen
/// </summary>
Fullscreen
}
public class PlaystateRequest