From 0a2b0ffba8848080d4cac824d3f44e2f12d8e20a Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Sat, 9 Mar 2013 01:13:10 -0500 Subject: [PATCH] progress on hls video. but not ready yet --- .../Playback/Hls/VideoHlsService.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index 39e1ca9d0..dfbed538f 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -1,10 +1,28 @@ -using MediaBrowser.Common.IO; +using System.IO; +using MediaBrowser.Common.IO; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using System; +using ServiceStack.ServiceHost; namespace MediaBrowser.Api.Playback.Hls { + [Route("/Videos/{Id}/stream.m3u8", "GET")] + [ServiceStack.ServiceHost.Api(Description = "Gets a video stream using HTTP live streaming.")] + public class GetHlsVideoStream : VideoStreamRequest + { + + } + + [Route("/Videos/{Id}/segments/{SegmentId}.ts", "GET")] + [ServiceStack.ServiceHost.Api(Description = "Gets an Http live streaming segment file. Internal use only.")] + public class GetHlsVideoSegment + { + public string Id { get; set; } + + public string SegmentId { get; set; } + } + public class VideoHlsService : BaseHlsService { public VideoHlsService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager) @@ -12,6 +30,25 @@ namespace MediaBrowser.Api.Playback.Hls { } + public object Get(GetHlsVideoSegment request) + { + var file = SegmentFilePrefix + request.SegmentId + Path.GetExtension(Request.PathInfo); + + file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file); + + return ToStaticFileResult(file); + } + + /// + /// Gets the specified request. + /// + /// The request. + /// System.Object. + public object Get(GetHlsVideoStream request) + { + return ProcessRequest(request); + } + /// /// Gets the audio arguments. ///