Playing video from Azure Media Service
🐛 Bug Report
I'm trying to play a video hosted on azure media services. I'm using the AzureMediaServiceItem class to set the current player url source. Nothing is shown in the VideoView. In the output the follwing error.
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): Source error.
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973)
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891)
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
04-30 19:15:54.191 E/ExoPlayerImplInternal(17126): at java.lang.Thread.run(Thread.java:764)
Expected behavior
The video should be played.
Reproduction steps
- Create a simple Xamarin app with a single page
- Add the Plugin.MediaManager.Forms
- Add the Plugin.MediaManager.AzureMediaServices
- Add the VideoView view in the page
- Configure the ViewView source via code with the follow code:
await CrossMediaManager.Current.Play(new AzureMediaServiceItem("https://.../manifest"));
Configuration
Version: 0.9.7
Platform:
- [ ] :iphone: iOS
- [X] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [X] :monkey: Xamarin.Forms
I believe you need to apply an appropriate suffix to the end of the uri to convert the /manifest into a readable stream type. eg. var media = new MediaManager.Library.MediaItem($"{insertYourURIHere}(format=mpd-time-csf)") { MediaType = MediaManager.Library.MediaType.Dash }; await CrossMediaManager.Current.Play(media);
Still getting error.
Source error
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): com.google.android.exoplayer2.ParserException: org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT #EXTM3U
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): #EXT-X-V...@9:1 in java.io.InputStreamReader@5ba3f81)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:96)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:61)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at com.google.android.exoplayer2.upstream.ParsingLoadable.load(ParsingLoadable.java:172)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:415)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at java.lang.Thread.run(Thread.java:764)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): Caused by: org.xmlpull.v1.XmlPullParserException: Unexpected token (position:TEXT #EXTM3U
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): #EXT-X-V...@9:1 in java.io.InputStreamReader@5ba3f81)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at org.kxml2.io.KXmlParser.next(KXmlParser.java:432)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at org.kxml2.io.KXmlParser.next(KXmlParser.java:313)
10-26 21:23:55.373 E/ExoPlayerImplInternal(31884): at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:89)
Ok got it, the right combination is:
- using the url with (format=m3u8-aapl)
- media type Hls
now it's working