我想将单个视频播放到两个播放器视图中,这意味着播放器只有一个实例。与此样本(Mulit-layer player)类似。在我目前的实现中,两个视频无法同时播放,一个正在播放,而另一个则显示黑屏。如何解决或实施?请分享任何想法。
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory =
new AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector =
new DefaultTrackSelector(videoTrackSelectionFactory);
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
backgroundPlayerView.setPlayer(player); //behind playerview
playerView.setPlayer(player); //front playerview
DataSource.Factory dataSourceFactory =
new DefaultDataSourceFactory(this, Util.getUserAgent(this, "Player"));
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("https://storage.googleapis.com/exoplayer-test-media-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv"),
dataSourceFactory, extractorsFactory, null, null);
player.prepare(mediaSource);