Android-VR 支持流媒体
Google对vr支持非常速度,从0.7版本开始关注gvr-Android-sdk,这个版本还是比较初级,还只能支持图片,本地视频,如果你选择一个remote视频,就会报io异常,看了下源码,还没对远程视频做支持。
不过2周时间就对远程视频支持了,可以使用http访问视频地址,我赶紧尝试了下,发现还是坑,只是对mp4等一些视频格式支持,老板要的是流媒体啊,对m3u8不支持怎么是好,赶紧去github提问,很快就收到回复,项目在集成EXOplayer,做个视频的都知道,这个项目也是Google开源的,对流媒体很好的支持,看到了希望。
又等了大概一个时间,0.8版本出来了,赶紧尝试,果然流媒体支持了,Google就是不一样。
接下来使用Google官方的实例sdk-simplevideowidget,去播放随意找来的一个m3u8格式视频
SimpleVrVideoActivity中:
private void handleIntent(Intent intent) {// Determine if the Intent contains a file to load.if (Intent.ACTION_VIEW.equals(intent.getAction())) {Log.i(TAG, "ACTION_VIEW Intent received");fileUri = intent.getData();if (fileUri == null) {Log.w(TAG, "No data uri specified. Use \"-d /path/filename\".");} else {Log.i(TAG, "Using file " + fileUri.toString());}//修改支持格式为 FORMAT_HLS 流媒体videoOptions.inputFormat = Options.FORMAT_HLS;} else {Log.i(TAG, "Intent is not ACTION_VIEW. Using the default video.");fileUri = null;}// Load the bitmap in a background thread to avoid blocking the UI thread. This operation can// take 100s of milliseconds.//把url直接转为uri传入Task loadTask(Uri.parse("http://cache.utovr.com/s1oc3vlhxbt9mugwjz/L2_1920_3_25.m3u8"));}
一是格式修改为hls;
videoOptions.inputFormat = Options.FORMAT_HLS;
二是把本地连接修改为自己的远程url
loadTask(Uri.parse("http://cache.utovr.com/s1oc3vlhxbt9mugwjz/L2_1920_3_25.m3u8"));
class VideoLoaderTask extends AsyncTask<Pair<Uri, Options>, Void, Boolean> {@Overrideprotected Boolean doInBackground(Pair<Uri, Options>... fileInformation) {try {if (fileInformation == null || fileInformation.length < 1|| fileInformation[0] == null || fileInformation[0].first == null) {videoWidgetView.loadVideoFromAsset("congo.mp4");} else {//remote视频还要设置下fileInformation,这个没啥好说的,根据API使用videoWidgetView.loadVideo(fileInformation[0].first, fileInformation[0].second);}} catch (IOException e) {// An error here is normally due to being unable to locate the file.loadVideoStatus = LOAD_VIDEO_STATUS_ERROR;// Since this is a background thread, we need to switch to the main thread to show a toast.videoWidgetView.post(new Runnable() {@Overridepublic void run() {Toast.makeText(SimpleVrVideoActivity.this, "Error opening file. ", Toast.LENGTH_LONG).show();}});Log.e(TAG, "Could not open video: " + e);}return true;}}
就改了这几个地方,在线视频播放起来了,vr开发是不是很简单,要搞清楚原理,后续分析。
实例源码下载
Android-VR 支持流媒体相关推荐
- android vr播放器 开发,Android应用开发之Android VR Player(全景视频播放器)- ExoPlayer播放器MPEG-DASH视频播放...
本文将带你了解Android应用开发之Android VR Player(全景视频播放器)- ExoPlayer播放器MPEG-DASH视频播放,希望本文对大家学Android有所帮助. Androi ...
- Tango+Daydream,刀剑合璧的Android VR开发
Tango+Daydream,刀剑合璧的Android VR开发 2017-01-03 随着ASUS在CES2017上宣布了全球第一款同时具有Tango和Daydream两种能力的ZenFone AR ...
- Android VR 视屏
Android VR 视屏 效果图 谷歌的VR: 虚拟实境(英语:virtual reality,缩写为VR),简称虚拟技术,也称虚拟环境,是利用电脑模拟产生一个三维空间的虚拟世界,提供用户关于视觉等 ...
- Windows Azure Mobile Services增加了对 Android的支持并扩展其适用范围至东亚地区
我们的Mobile Services使开发人员很容易地开发丰富多彩的移动应用程序.使用Mobile Services ,开发人员不仅能够连接其应用程序到 Windows Azure 上易扩展又安全的后 ...
- android alpha不起作用,API 28(P)的Android设计支持库不起作用
我已经成功配置了android-P SDK环境.当我尝试使用android设计支持库时,我遇到项目构建错误.项目配置为: IDE:3.2 Canary 17目标API:28编译API:28 apply ...
- Android WebView 支持H5图片上传input type=file
2019独角兽企业重金招聘Python工程师标准>>> Android WebView 缓存处理 Android WebView 支持H5图片上传<input type=&qu ...
- Android recovery支持adb shell
Android recovery支持adb shell 最近开发过程注意到recovery不支持adb shell,为了便于调试方便,决定增加此功能. 刚开始我们采用的是user版本系统,进入reco ...
- Android 测试支持库 1.0 现已发布!
我们非常高兴地宣布,Android 测试支持库 (ATSL) 1.0 版现已发布. ATSL 1.0 版对现有测试 API 进行了重要更新,不仅添加了许多新功能.还提升了性能和稳定性,同时还修复了若干 ...
- SAP BTP SDK for Android 已经支持 Kotlin 了
2011年7月19日,Kotlin公开亮相,目前已经成为公认的Android开发推荐使用的语言,也早已被SAP BTP SDK for Android所支持.推出Kotlin的JetBrains公司, ...
- Android ContentProvider支持跨进程数据共享与互斥、同步 杂谈
在开发中,假如,A.B进程有部分信息需要同步,这个时候怎么处理呢?设想这么一个场景,有个业务复杂的Activity非常占用内存,并引发OOM,所以,想要把这个Activity放到单独进程,以保证OOM ...
最新文章
- VS2010单元测试入门实践教程
- Nginx之https配置
- (一四三)类设计回顾
- 如何解决Qt程序在其他电脑上无法运行的问题(Qt程序打包发布)
- c面向对象 java_JAVA基础--面向对象08
- 【源码解读】EOS测试插件:txn_test_gen_plugin.cpp
- mysql文章列表_MySQL-分享文章列表 - Su的博客
- Xshell/Xftp个人完全免费版
- 忘记linux虚拟机密码怎么办
- 当不知轴承型号时如何寻找轴承故障频率_轴承故障的检测,处理
- 史上最全C/C++思维导图,B站疯传,快收藏!!(附配套学习视频)
- Linux系统中修复SambaCry漏洞(CVE-2017-7494)
- 金融壹账通拟7月4日香港上市:2年亏近30亿 市值蒸发超90%
- 不规则四面体知道六边的体积公式
- 吹气球-LintCode
- python 制作抽奖箱_抽奖箱怎么做
- Cornerstone清除缓存
- 虚拟机报错模块“Disk”启动失败。 未能启动虚拟机。
- 如何把bibtex的文献导入到endnote里面
- windows 10 __同时管理多个窗口的使用技巧(拼接多个窗口,虚拟桌面等)