Xamarin ExoPlayer在Java代码中引发了异常

时间:2018-05-31 11:38:09

标签: c# android xamarin.android stream exoplayer

我正在尝试使用Xamarin.Android上的ExoPlayer运行一个简单的演示,所以我通过Nuget安装了ExoPlayer,添加了以下简单的代码来播放音频:

 private SimpleExoPlayer _player;
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        var mediaUrl = "http://api-streaming.youscribe.com/v1/products/2919465/documents/3214936/audio/stream";
        var mediaUri = Android.Net.Uri.Parse(mediaUrl);

        var userAgent = Util.GetUserAgent(this, "ExoPlayerDemo");
        var defaultHttpDataSourceFactory = new DefaultHttpDataSourceFactory(userAgent);
        var defaultDataSourceFactory = new DefaultDataSourceFactory(this, 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(this, defaultTrackSelector);
        _player.Prepare(extractorMediaSource);
        _player.PlayWhenReady = true;

        SetContentView(Resource.Layout.Main);
    } 

运行此代码时,我收到以下异常:

  

错误:AnalyticsListenerImplementor不是抽象的,并且不会覆盖AnalyticsListener中的抽象方法onRenderedFirstFrame(EventTime,Surface)   公共类AnalyticsListenerImplementor

我该如何解决?任何帮助将不胜感激。

0 个答案:

没有答案