Android直播app
看了网上大部分关于网络直播的介绍,无非是有网络直播流地址,然后加上播放器就可以了,实现起来其实不难。
直播框架:
- 抓取网络直播流地址
这个就不多介绍了,出于学习目的可以自己找,例如you-get,还有电视之家的网络电视直播源,一般的rmtp和m3u8的流地址都可以。 - github有名的开源播放器JiaoZiVideoPlayer
Android控件
看个人喜好,可以用GridView或ListView,或者用ExpandableListView。加上RefreshLayout可以实现下拉刷新,上拉加载,这里使用SmartRefreshLayout
- ExpandableListView
类似QQ好友列表的使用功能:
<?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">
<ExpandableListView
android:id="@+id/expand_list_tv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
效果图:
- GridView
<?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">
<GridView
android:id="@+id/gvLivingList"
android:numColumns="2"
android:horizontalSpacing="5dp"
android:verticalSpacing="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
</GridView>
</LinearLayout>
效果图:
- ListView
<?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">
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
</ListView>
</LinearLayout>
效果图: