google vr 入门之制作简易的VR播放器及去除界面控制按钮

在moudle app 的build.gradle文件中 dependencies 节点下添加如下配置:// 使用google vr 添加的compile ‘com.google.vr:sdk-base:1.10.0’compile ‘com.google.vr:sdk-audio:1.10.0’compile ‘com.google.vr:sdk-videowidget:1.10.0’//使用播放控件需要添加(VrVideoView)做好如上配置之后,便可以写代码了。在布局文件中添加播放器控件
摘要由CSDN通过智能技术生成

在moudle app 的build.gradle文件中 dependencies 节点下添加如下配置:

// 使用google vr 添加的

compile ‘com.google.vr:sdk-base:1.10.0’

compile ‘com.google.vr:sdk-audio:1.10.0’

compile ‘com.google.vr:sdk-videowidget:1.10.0’//使用播放控件需要添加(VrVideoView)

做好如上配置之后,便可以写代码了。

在布局文件中添加播放器控件VrVideoView

<com.google.vr.sdk.widgets.video.VrVideoView

android:id="@+id/video_view"

android:layout_width=“match_parent”

android:layout_height=“match_parent”/>

在Activity中找到控件,设置播放资源即可实现播放。

mVideoView = (VrVideoView) findViewById(R.id.video_view);

VrVideoView.Options option = new VrVideoView.Options();

try {

mVideoView.loadVideo(uri, option);

} catch (IOException e) {

e.printStackTrace();

}

到这我们的播放器就可以播放了,最基本的播放功能就已经实现了。不过这种太简陋了,我们的播放器应该有一些控制按钮,而且是VR播放器应该有VR模式才行,不能是简单的全屏就完了。

下面我们开始正式制作我们的简易版播放器:

activity_player.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout

xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:tools=“http://schemas.android.com/tools”

android:id="@+id/activity_main"

android:layout_width=“match_parent”

android:layout_height=“match_parent”

tools:context=“com.qj.gvr_test.MainActivity”>

<com.google.vr.sdk.widgets.video.VrVideoView

android:id="@+id/video_view"

android:layout_width=“match_parent”

android:layout_height=“match_parent”/>

<LinearLayout

android:id="@+id/video_progress_container"

android:layout_width="@dimen/y1000"

android:layout_height="@dimen/y100"

android:layout_alignParentBottom=“true”

android:layout_centerHorizontal=“true”

android:layout_marginBottom="@dimen/y100"<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值