我正在尝试使用 Fenster 在 Android 中显示视频,但到目前为止我只能获得音频。视频无法播放,但我可以听到音频。
我的 xml 文件是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/llShowDrop"
android:background="#FFF">
<com.malmstein.fenster.view.FensterVideoView
android:id="@+id/play_video_texture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
android:fitsSystemWindows="true"
android:visibility="visible" />
<com.malmstein.fenster.controller.SimpleMediaFensterPlayerController
android:id="@+id/play_video_controller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
android:visibility="visible"
android:layout_above="@+id/llLastComment" />
</RelativeLayout>
我的 .java 文件是:
final FensterVideoView textureView = (FensterVideoView) llShowDrop.findViewById(R.id.play_video_texture);
final SimpleMediaFensterPlayerController playerController = (SimpleMediaFensterPlayerController) llShowDrop.findViewById(R.id.play_video_controller);
textureView.setMediaController(playerController);
textureView.setVideo("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4", playerController.DEFAULT_VIDEO_START);
textureView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
textureView.start();
}
});
playerController.setVisibilityListener(new FensterPlayerControllerVisibilityListener() {
@Override
public void onControlsVisibilityChange(boolean value) {
setSystemUiVisibility(value, playerController);
}
});;
有谁知道为什么这不播放视频而只播放音频? 在此先感谢您的帮助!
最佳答案
结果是模拟器无法播放视频。我在我的三星上测试过它,效果很好。
关于java - Fenster FensterVideoView Android 只播放声音,不播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34939352/