mixed refactor
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.SRFPlay.Api.Models;
|
||||
using Jellyfin.Plugin.SRFPlay.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Factory for creating MediaSourceInfo objects with consistent configuration.
|
||||
/// </summary>
|
||||
public interface IMediaSourceFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a MediaSourceInfo for a chapter with proper stream authentication and proxy registration.
|
||||
/// </summary>
|
||||
/// <param name="chapter">The chapter containing stream resources.</param>
|
||||
/// <param name="itemId">The unique item ID for proxy registration.</param>
|
||||
/// <param name="urn">The URN of the content.</param>
|
||||
/// <param name="qualityPreference">The preferred quality.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>A configured MediaSourceInfo, or null if stream URL cannot be resolved.</returns>
|
||||
Task<MediaSourceInfo?> CreateMediaSourceAsync(
|
||||
Chapter chapter,
|
||||
string itemId,
|
||||
string urn,
|
||||
QualityPreference qualityPreference,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Builds a proxy URL for an item.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item ID.</param>
|
||||
/// <returns>The full proxy URL including server address.</returns>
|
||||
string BuildProxyUrl(string itemId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the server base URL (configured public URL or smart URL).
|
||||
/// </summary>
|
||||
/// <returns>The server base URL without trailing slash.</returns>
|
||||
string GetServerBaseUrl();
|
||||
|
||||
/// <summary>
|
||||
/// Creates MediaStream metadata based on quality preference.
|
||||
/// </summary>
|
||||
/// <param name="quality">The quality preference.</param>
|
||||
/// <returns>List of MediaStream objects for video and audio.</returns>
|
||||
IReadOnlyList<MediaStream> CreateMediaStreams(QualityPreference quality);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
||||
public interface IStreamProxyService
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers a stream for proxying.
|
||||
/// Registers a stream for proxying with an already-authenticated URL.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item ID.</param>
|
||||
/// <param name="authenticatedUrl">The authenticated stream URL.</param>
|
||||
@@ -17,6 +17,16 @@ public interface IStreamProxyService
|
||||
/// <param name="isLiveStream">Whether this is a livestream (livestreams always fetch fresh URLs).</param>
|
||||
void RegisterStream(string itemId, string authenticatedUrl, string? urn = null, bool isLiveStream = false);
|
||||
|
||||
/// <summary>
|
||||
/// Registers a stream for deferred authentication (authenticates on first playback request).
|
||||
/// Use this when browsing to avoid wasting 30-second tokens before the user clicks play.
|
||||
/// </summary>
|
||||
/// <param name="itemId">The item ID.</param>
|
||||
/// <param name="unauthenticatedUrl">The unauthenticated stream URL.</param>
|
||||
/// <param name="urn">The SRF URN for this content.</param>
|
||||
/// <param name="isLiveStream">Whether this is a livestream.</param>
|
||||
void RegisterStreamDeferred(string itemId, string unauthenticatedUrl, string? urn = null, bool isLiveStream = false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets stream metadata for an item (URN and isLiveStream flag).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user