首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vitamio全屏videoview

Vitamio全屏videoview
EN

Stack Overflow用户
提问于 2013-06-20 06:43:34
回答 5查看 6.5K关注 0票数 3

我试着和Vitamio一起玩直播。我修复了一些问题,但是我不能解决这个问题。视频不能全屏播放。这些是我的密码。我希望你能帮助我!谢谢并为我糟糕的英语感到抱歉。

代码语言:javascript
复制
package com.uusoftware.tvizle;

import io.vov.vitamio.widget.MediaController;
import io.vov.vitamio.widget.VideoView;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.WindowManager;

public class Trt extends Activity{

    VideoView videoView;

    private void Trt1(){
        String httpLiveUrl = "rtmp://trt-i.mncdn.com/trt1/trt15";   
        videoView = (VideoView) findViewById(R.id.VideoView);
        videoView.setVideoURI(Uri.parse(httpLiveUrl));
        MediaController mediaController = new MediaController(this);
        videoView.setMediaController(mediaController);
        videoView.requestFocus();
        videoView.start();
    }


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.videolayout);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        Trt1();             
    }     
}


<?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="match_parent"
        android:orientation="vertical" >

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

</LinearLayout>
EN

回答 5

Stack Overflow用户

发布于 2014-05-06 04:54:18

VideoView放在RelativeLayout中,并将其设置为:

代码语言:javascript
复制
<io.vov.vitamio.widget.VideoView 
         android:id="@+id/vitamioView" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:layout_alignParentLeft="true" 
         android:layout_alignParentTop="true" 
         android:layout_alignParentRight="true" 
         android:layout_alignParentBottom="true" />
票数 5
EN

Stack Overflow用户

发布于 2014-06-11 15:02:11

使用此方法在活动的onCreate()方法中扩展视频视图

代码语言:javascript
复制
mVideoView.setVideoLayout(VideoView.VIDEO_LAYOUT_STRETCH, 0);

处理onConfigurationChange();

使用下面的代码

代码语言:javascript
复制
@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");
    }

}

还要将此代码添加到您的活动menifest文件中

代码语言:javascript
复制
android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
票数 1
EN

Stack Overflow用户

发布于 2014-11-13 10:59:29

代码语言:javascript
复制
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
        mVideoView.setVideoLayout(io.vov.vitamio.widget.VideoView.VIDEO_LAYOUT_STRETCH, 0);

} else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
        mVideoView.setVideoLayout(io.vov.vitamio.widget.VideoView.VIDEO_LAYOUT_ORIGIN, 0);
}

感谢@Qadir侯赛因.it为我工作

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17202603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档