在我的视频播放器中,当我尝试播放MKV Matroska文件时,它保持静止,视频未播放。
我跟随CodeLabs和ExoPlayer Dev并构建了可以播放.MP4但无法播放的播放器.MKV
这是我的播放器:(exoplayer 2.11.5)
private void initializePlayer() {
if (player == null) {
player = new SimpleExoPlayer.Builder(this).build();
playerView.setPlayer(player);
Uri uri = Uri.parse(String.valueOf(videoUri));
MediaSource mediaSource = buildMediaSource(uri);
player.setPlayWhenReady(playWhenReady);
player.seekTo(currentWindow, playbackPosition);
player.addListener(playbackStateListener);
player.prepare(mediaSource, false, false);
}
}
private MediaSource buildMediaSource(Uri uri) {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, "exoplayer-codelab");
@C.ContentType int type = Util.inferContentType(uri);
switch (type) {
case C.TYPE_DASH:
return new DashMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
case C.TYPE_SS:
return new SsMediaSource.Factory(dataSourceFactory).createMediaSource(uri);
case C.TYPE_HLS:
return new …Run Code Online (Sandbox Code Playgroud) 我正在遵循教程(9.2),它要求添加一个“设置活动”,当我尝试选择它时,它呈灰色并显示“需要 androidx 支持”。我在教程中找不到有关 androidx 支持的参考,并且尝试用谷歌搜索该问题但无济于事。我什至从主文件中加载了完成的项目,以将它们的代码与我的代码进行比较,我找不到对 androidx.txt 的引用。我使用的是android studio 3.4.1