简体   繁体   English

Android Vitamio视频全屏不工作

[英]Android Vitamio Video FullScreen not Working

I have downloaded the Vitamio sample from here http://www.vitamio.org/en/Download/ and I'm successfully playing video on my Android Screen. 我从http://www.vitamio.org/en/Download/下载了Vitamio样本,我在Android屏幕上成功播放了视频。 But if I change my screen orientation, I'm unable to get FullScreen Mode. 但如果我改变我的屏幕方向,我将无法获得全屏模式。

Could anyone Help? 有人可以帮忙吗?

Layout: 布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <io.vov.vitamio.widget.CenterLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
         android:layout_marginTop="40dp"

        android:orientation="vertical" >

        <io.vov.vitamio.widget.VideoView
            android:id="@+id/surface_view"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true" />
    </io.vov.vitamio.widget.CenterLayout>


    <FrameLayout
                android:id="@+id/mainlayout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginLeft="1dp"
                android:orientation="vertical" >

                <ImageButton
                    android:id="@+id/playbtn"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_marginLeft="1dp"

                    android:background="@drawable/play" />

                <ImageButton
                    android:id="@+id/pausebtn"
                    android:layout_width="30dp"
                   android:layout_marginLeft="1dp"

                    android:layout_height="30dp"
                    android:background="@drawable/pause" />
                 <SeekBar
                android:id="@+id/seekBar1"
                android:layout_width="270dp"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/mainlayout"
                android:layout_marginLeft="40dp"
                android:layout_marginRight="1dp" />

            </FrameLayout>





</LinearLayout>

try this 尝试这个

<io.vov.vitamio.widget.VideoView
    android:id="@+id/video"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true" 
</io.vov.vitamio.widget.CenterLayout>

Use this method to stretch your videoview in onCreate() method of your activity 使用此方法可以在活动的onCreate()方法中拉伸视频视图

mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);

To handle onConfigurationChange(); 处理onConfigurationChange();

use below code 使用下面的代码

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {

        mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);
        Log.e("On Config Change", "LANDSCAPE");

    } else {
        mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);
        Log.e("On Config Change", "PORTRAIT");
    }

}

also add this in your activity menifest file 还要在您的活动清单文件中添加此项

android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM