fixes #838 - Support rtmp protocol with channels
This commit is contained in:
@@ -8,6 +8,7 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using ServiceStack.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -118,13 +119,13 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
var responseHeaders = new Dictionary<string, string>();
|
||||
|
||||
// Static remote stream
|
||||
if (request.Static && state.IsRemote)
|
||||
if (request.Static && state.InputProtocol == MediaProtocol.Http)
|
||||
{
|
||||
AddDlnaHeaders(state, responseHeaders, true);
|
||||
|
||||
try
|
||||
{
|
||||
return GetStaticRemoteStreamResult(state.MediaPath, responseHeaders, isHeadRequest).Result;
|
||||
return GetStaticRemoteStreamResult(state, responseHeaders, isHeadRequest).Result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -132,6 +133,11 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
}
|
||||
}
|
||||
|
||||
if (request.Static && state.InputProtocol != MediaProtocol.File)
|
||||
{
|
||||
throw new ArgumentException(string.Format("Input protocol {0} cannot be streamed statically.", state.InputProtocol));
|
||||
}
|
||||
|
||||
var outputPath = state.OutputFilePath;
|
||||
var outputPathExists = File.Exists(outputPath);
|
||||
|
||||
@@ -186,16 +192,19 @@ namespace MediaBrowser.Api.Playback.Progressive
|
||||
/// <summary>
|
||||
/// Gets the static remote stream result.
|
||||
/// </summary>
|
||||
/// <param name="mediaPath">The media path.</param>
|
||||
/// <param name="state">The state.</param>
|
||||
/// <param name="responseHeaders">The response headers.</param>
|
||||
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
|
||||
/// <returns>Task{System.Object}.</returns>
|
||||
private async Task<object> GetStaticRemoteStreamResult(string mediaPath, Dictionary<string, string> responseHeaders, bool isHeadRequest)
|
||||
private async Task<object> GetStaticRemoteStreamResult(StreamState state, Dictionary<string, string> responseHeaders, bool isHeadRequest)
|
||||
{
|
||||
string useragent = null;
|
||||
state.RemoteHttpHeaders.TryGetValue("User-Agent", out useragent);
|
||||
|
||||
var options = new HttpRequestOptions
|
||||
{
|
||||
Url = mediaPath,
|
||||
UserAgent = GetUserAgent(mediaPath),
|
||||
Url = state.MediaPath,
|
||||
UserAgent = useragent,
|
||||
BufferContent = false
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user