diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-09 01:05:52 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-03-09 01:05:52 -0500 |
| commit | 9b3a97edfc1d37de37986b4bdac3263c9367bf8f (patch) | |
| tree | 4eb0a96c04afdc9cd4ba65e07fc07cf64bda3eab /MediaBrowser.Api/Playback/Hls/AudioHlsService.cs | |
| parent | 2828688ced9328b0b4bc688e1146cbf3b4ac11d5 (diff) | |
some progress towards brining back hls, but not finished yet
Diffstat (limited to 'MediaBrowser.Api/Playback/Hls/AudioHlsService.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/AudioHlsService.cs | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs index a98f27499..ecdab94b3 100644 --- a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs @@ -2,11 +2,33 @@ using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Dto; +using ServiceStack.ServiceHost; using System; +using System.IO; namespace MediaBrowser.Api.Playback.Hls { /// <summary> + /// Class GetHlsAudioStream + /// </summary> + [Route("/Audio/{Id}/stream.m3u8", "GET")] + [ServiceStack.ServiceHost.Api(Description = "Gets an audio stream using HTTP live streaming.")] + public class GetHlsAudioStream : StreamRequest + { + + } + + [Route("/Audio/{Id}/segments/{SegmentId}.mp3", "GET")] + [Route("/Audio/{Id}/segments/{SegmentId}.aac", "GET")] + [ServiceStack.ServiceHost.Api(Description = "Gets an Http live streaming segment file. Internal use only.")] + public class GetHlsAudioSegment + { + public string Id { get; set; } + + public string SegmentId { get; set; } + } + + /// <summary> /// Class AudioHlsService /// </summary> public class AudioHlsService : BaseHlsService @@ -16,6 +38,25 @@ namespace MediaBrowser.Api.Playback.Hls { } + public object Get(GetHlsAudioSegment request) + { + var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(Request.PathInfo); + + file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file); + + return ToStaticFileResult(file); + } + + /// <summary> + /// Gets the specified request. + /// </summary> + /// <param name="request">The request.</param> + /// <returns>System.Object.</returns> + public object Get(GetHlsAudioStream request) + { + return ProcessRequest(request); + } + /// <summary> /// Gets the audio arguments. /// </summary> @@ -75,7 +116,7 @@ namespace MediaBrowser.Api.Playback.Hls return ".mp3"; } - throw new InvalidOperationException("Only aac and mp3 audio codecs are supported."); + throw new ArgumentException("Must specify either aac or mp3 audio codec."); } /// <summary> |
