-
Notifications
You must be signed in to change notification settings - Fork 24
Fix HLS streaming (use AdaptiveMediaSource instead of MediaSource) #8
Conversation
{ | ||
return MediaSource.CreateFromUri(new Uri(streamUrl)); | ||
return MediaSource.CreateFromAdaptiveMediaSource(mediaSource); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should only do this for hls content types
@@ -61,7 +65,7 @@ public PlayerViewModel(IGrooveClient grooveClient, GrooveApiErrorViewModel error | |||
|
|||
if (!string.IsNullOrEmpty(streamResponse.Url)) | |||
{ | |||
StreamUrl = streamResponse.Url; | |||
MediaSource = (await AdaptiveMediaSource.CreateFromUriAsync(new Uri(streamResponse.Url))).MediaSource; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be interesting to add a comment to explain why this is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need to fix non HLS content playback
79fcc68
to
45060aa
Compare
MediaSource = | ||
streamResponse.ContentType == "application/vnd.apple.mpegurl" | ||
? MediaSource.CreateFromAdaptiveMediaSource( | ||
(await AdaptiveMediaSource.CreateFromUriAsync(streamResponseUri)).MediaSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(await AdaptiveMediaSource.CreateFromUriAsync(streamResponseUri)).MediaSource) [](start = 28, length = 78)
in the sample codes we saw this morning on the interwebs everyone seemed to check if the AdaptiveMediaSource had a success status before passing it to the MediaSource, do you know if that's important?
45060aa
to
9c9d2f5
Compare
} | ||
} | ||
|
||
private async Task<MediaSource> GetMediaSource(Uri streamUri, string contentType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining why this is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
9c9d2f5
to
a9236a9
Compare
No description provided.