Android直播之Vitamio的
来源:互联网 发布:什么是数据共享 编辑:程序博客网 时间:2024/06/01 13:11
1、下载vitamio
https://www.vitamio.org/
https://github.com/littleMeng/video-live斗鱼直播Demo
https://github.com/xiaohaibin/VitamioDemo
2、studio导入Module
直接以module的方式引入
3、配置清单文件
1)权限设置:
<uses-permission android:name="android.permission.WAKE_LOCK" /><uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
2)application配置:
<!-- 必须初始化 --><activity android:name="io.vov.vitamio.activity.InitActivity" android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation" android:launchMode="singleTop" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="stateAlwaysHidden" />
4、初始化布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.dzxx.live.MainActivity"> <io.vov.vitamio.widget.VideoView android:id="@+id/videoView" android:layout_width="match_parent" android:layout_height="200dp" /></RelativeLayout>
5、主页面初始化进行播放
if (!LibsChecker.checkVitamioLibs(this)) return; setContentView(R.layout.activity_main); videoView = (VideoView) findViewById(R.id.videoView); //videoView.setVideoURI(Uri.parse("rtmp://live.hkstv.hk.lxdns.com/live/hks"));//设置播放地址 videoView.setVideoPath("rtmp://live.hkstv.hk.lxdns.com/live/hks"); videoView.setMediaController(new MediaController(this)); //videoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH);//高画质 //videoView.start();//开始播放 videoView.requestFocus(); //设置监听 videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { mp.setPlaybackSpeed(1.0f); } });最后运行就可以进行播放,注意要等待几秒钟,视频需要缓冲一会。
还有几个不错的博客
http://www.jianshu.com/p/d50a67ba253c?nomobile=yes
http://www.cnblogs.com/over140/archive/2012/07/09/2582512.html
http://blog.csdn.net/yueqinglkong/article/details/41513709
1 0
- Android直播之Vitamio的
- Android Vitamio 直播视频播放功能的实现
- Android Vitamio 直播视频播放功能的实现
- android vitamio的使用
- android开发之Vitamio使用之如何直播RTMP流、m3u8流(HLS)、RTSP流和 MMS流
- Android中Vitamio使用解析-电视台直播为例
- Android之Vitamio视频框架
- 玩转Android之在线视频播放控件Vitamio的使用
- 玩转Android之在线视频播放控件Vitamio的使用
- vitamio for android的使用
- Android Vitamio的使用解析
- 使用vitamio做直播demo
- android开发之Vitamio介绍以及常见问题
- Android 多媒体应用:视频播放之Vitamio
- Android之集成万能播放器Vitamio
- 学习笔记之Vitamio的MediaPlayer
- android视频播放器Vitamio的使用
- Android开发---Vitamio框架的实战应用
- 记录有点意思的网站
- 242. Valid Anagram
- C++ std::vector元素的内存分配问题(补充)
- 安装Server2003+SQL2000+SQL2000SP4
- missian(4)使用异步客户端
- Android直播之Vitamio的
- Linux程序源码编译安装的configure配置详解
- PAT乙级1064 朋友数
- ==和equals方法的区别以及Integer和String的应用
- RESTful架构详解
- GoogleAds Unity Plugin中文教程最新版本
- P1085
- 核技法、软间隔分类器、SMO算法——斯坦福ML公开课笔记8
- maven与spring,hibernate,springmvc项目注意问题