我的视频播放器没有在运行Android Marshmallow的华硕Zenfone 2上播放。我不知道缓存库或ExoPlayer是否存在问题。
我的代码如下 -
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector = new DefaultTrackSelectorvideoTrackSelectionFactory);
exoPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector);
mBetterVideoPlayer.setKeepScreenOn(true);
mBetterVideoPlayer.setPlayer(exoPlayer);
mBetterVideoPlayer.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_ZOOM);
HttpProxyCacheServer proxy = AppBaseApplication.getProxy(NewWorkoutVideoActivity.this);
proxy.registerCacheListener(NewWorkoutVideoActivity.this, current.getVideo());
proxyUrl = proxy.getProxyUrl(current.getVideo());
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(),Util.getUserAgent(this, "yourApplicationName"));
MediaSource videoSource = new ExtractorMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(proxyUrl));
exoPlayer.prepare(videoSource);