some progress towards brining back hls, but not finished yet

This commit is contained in:
LukePulverenti
2013-03-09 01:05:52 -05:00
parent 2828688ced
commit 9b3a97edfc
3 changed files with 53 additions and 8 deletions

View File

@@ -52,10 +52,11 @@ namespace MediaBrowser.Api.Playback.Hls
/// <summary>
/// Processes the request.
/// </summary>
/// <param name="state">The state.</param>
/// <returns>System.Object.</returns>
protected object ProcessRequest(StreamState state)
protected object ProcessRequest(StreamRequest request)
{
var state = GetState(request);
return ProcessRequestAsync(state).Result;
}
@@ -85,12 +86,10 @@ namespace MediaBrowser.Api.Playback.Hls
var content = Encoding.UTF8.GetBytes(playlistText);
var stream = new MemoryStream(content);
try
{
Response.ContentType = MimeTypes.GetMimeType("playlist.m3u8");
return new StreamWriter(stream);
return content;
}
finally
{
@@ -130,6 +129,8 @@ namespace MediaBrowser.Api.Playback.Hls
// The segement paths within the playlist are phsyical, so strip that out to make it relative
fileText = fileText.Replace(Path.GetDirectoryName(playlist) + Path.DirectorySeparatorChar, string.Empty);
fileText = fileText.Replace(SegmentFilePrefix, "segments/");
// Even though we specify target duration of 9, ffmpeg seems unable to keep all segments under that amount
fileText = fileText.Replace("#EXT-X-TARGETDURATION:9", "#EXT-X-TARGETDURATION:10");