Baseflow / ExoPlayerXamarin

Xamarin bindings library for the Google ExoPlayer library
https://baseflow.com
MIT License
153 stars 66 forks source link

HLS Playback using Xamarin.Forms #155

Closed BajakiGabesz closed 1 year ago

BajakiGabesz commented 1 year ago

🔙 Regression

I found the Nuget package for Xamarin.Forms and it is working quite well such as it is playing audio well in the background, but we have video support in our application as well which is based on HLS and as soon as we try to play such a video it does nothing. I checked the code and find the Dash, HLS, and SmoothStreaming support were stripped out from this version of MediaManager by commit 94e61d35 by @janwiebe-jump. I don't think it happened on purpose and may someone else also wants to use the HLS functionality. When I wanted to reactivate I got the type name Factory not found on HlsMediaSource. I think it is a kind of issue with the bindings. I am happy to help with the bindings but at this moment I don't even know where to start the investigation, so I need your guidance or if it is already done somewhere. We have to stay at Xamarin.Forms at the moment as we have multiple plugins which don't support MAUI yet and moving to MAUI takes a longer time, while without the version of Xamarin.Forms of this plugin we face with ActivityManager excessive CPU issues.

I just give it a try and it is working fine for the MAUI version.

Old (and correct) behavior

The HLS video was playing without a problem.

Current behavior

The HLS video doesn't even start.

Reproduction steps

Simply just add VideoView on a Xamarin.Froms page and use demo HLS to play, like this

Configuration

Xamarin.Forms 5.0.0.2578

Version: 1.2.4-xamarin

Platform:

ArchangelWTF commented 1 year ago

I'm currently having a look at this issue for the Xamarin branch while looking at the codebase that @janwiebe-jump (https://github.com/janwiebe-jump/XamarinMediaManager/tree/feature/2023-xamarin-android-12) has over here I'm also checking to make sure that DASH and Smoothstreaming have their respective factories as well.

The fix should not be that difficult to do so I'll apply it together with the merge to Exoplayer 2.18.3

ArchangelWTF commented 1 year ago

@BajakiGabesz Did the update I did quite some time back fix this issue?

BajakiGabesz commented 4 months ago

Thanks for your effort and sorry for just replying now. I tried it, but i had no success. In the MAUI variant, we could use the HlsMediaSource.Factory but it is not available anymore, but only for Xamarin. I know Xamarin.Forms is out of support but it would be nice to get the same behavior that the MAUI variant has. I tried the following packages: Xam.Plugins.Android.ExoPlayer: 2.19.1-xamarin1 2.18.10-xamarin1 2.18.9-xamarin.1

By using reflection and getting the class and Factory constructor, playing HLS works just fine, but it is not a nice solution. Maybe i didn't do something properly?