Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/models/playback/playback_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class PlaybackModelHelper {
final trickPlay = (await api.getTrickPlay(item: fullItem.body, ref: ref))?.body;
final chapters = fullItem.body?.overview.chapters ?? [];

final mediaPath = isValidVideoUrl(mediaSource?.path ?? "");

if (mediaSource == null) return null;

if ((mediaSource.supportsDirectStream ?? false) || (mediaSource.supportsDirectPlay ?? false)) {
Expand All @@ -230,7 +232,9 @@ class PlaybackModelHelper {
chapters: chapters,
playbackInfo: playbackInfo,
trickPlay: trickPlay,
media: Media(url: '${ref.read(userProvider)?.server ?? ""}/Videos/${mediaSource.id}/stream?$params'),
media: Media(
url: mediaPath ?? '${ref.read(userProvider)?.server ?? ""}/Videos/${mediaSource.id}/stream?$params',
),
mediaStreams: mediaStreamsWithUrls,
);
} else if ((mediaSource.supportsTranscoding ?? false) && mediaSource.transcodingUrl != null) {
Expand All @@ -252,6 +256,11 @@ class PlaybackModelHelper {
}
}

String? isValidVideoUrl(String path) {
Uri? uri = Uri.tryParse(path);
return (uri != null && uri.hasScheme && uri.hasAuthority) ? path : null;
}

Future<List<ItemBaseModel>> collectQueue(ItemBaseModel model) async {
switch (model) {
case EpisodeModel _:
Expand Down