Fenster FensterVideoView Android只播放声音,没有视频

时间:2016-01-22 05:03:49

标签: java android android-mediaplayer textureview

我尝试使用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);
     }
});;

有谁知道为什么这不播放视频而只播放音频? 在此先感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

原来模拟器无法播放视频。我在我的三星测试它,它完美地工作。

相关问题