Xam.Plugins.Android.ExoPlayer.Cast

Xamarin bindings for ExoPlayer


Keywords
exoplayer, xamarin, exo, monodroid, C#, xamarin.android, audio, media, android, player, streaming, mp3, c-sharp, google-exoplayer, mediaplayer, nuget
License
MIT
Install
Install-Package Xam.Plugins.Android.ExoPlayer.Cast -Version 2.9.7

Documentation

ExoPlayer Plugin for Xamarin

license Build status NuGet NuGet Pre Release GitHub tag MyGet

Xamarin bindings library for the Google ExoPlayer library.

ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.

WARNING: Exoplayer 2.9.0 and up requires Visual Studio 2019 with R8 and D8. Readmore at: https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-preview#d8-r8

Documentation

Using ExoPlayer

The ExoPlayer plugin is available on Nuget.

    SimpleExoPlayer _player;
    var mediaUri = Android.Net.Uri.Parse("https://ia800806.us.archive.org/15/items/Mp3Playlist_555/AaronNeville-CrazyLove.mp3");

    var userAgent = Util.GetUserAgent(context, "ExoPlayerDemo");
    var defaultHttpDataSourceFactory = new DefaultHttpDataSourceFactory(userAgent);
    var defaultDataSourceFactory = new DefaultDataSourceFactory(context, null, defaultHttpDataSourceFactory);
    var extractorMediaSource = new ExtractorMediaSource(mediaUri, defaultDataSourceFactory, new DefaultExtractorsFactory(), null, null);
    var defaultBandwidthMeter = new DefaultBandwidthMeter();
    var adaptiveTrackSelectionFactory = new AdaptiveTrackSelection.Factory(defaultBandwidthMeter);
    var defaultTrackSelector = new DefaultTrackSelector(adaptiveTrackSelectionFactory);

    _player = ExoPlayerFactory.NewSimpleInstance(context, defaultTrackSelector);
    _player.Prepare(extractorMediaSource);
    _player.PlayWhenReady = true;

See the Exoplayer.Droid sample app for further details.

Thanks to

License

  • ExoPlayerXamarin plugin is licensed under MIT