java 流媒体开发_流媒体开发之--直播实现

可可工作室出品:

欢迎使用可可直播视频播放器:

网上大多数直播软件都会提供一个功能就是自定义,这个由于版本问题,而为了让用户看到自己想看的频道,可以让用户自己添加找到的源,然后进行播放,俗话说法不责众,这个功能是如何实现的呢,其实也是很简单的,无法就是记录下用户添加的数据,然后保存下来,这里主要用到了数据库,用户点击自己添加的源,程序会从数据库取出链接,例如http,rtsp等开头的流媒体链接,具体的实现如下,我们是在之前

首先就是设计一个布局,里面使用ListView来填充,custom.xml,内容如下:

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:id="@+id/custom_title"

android:layout_width="match_parent"

android:layout_height="30dp"

android:text="直播"

android:textSize="27sp"

android:gravity="center"

/>

android:id="@+id/custom_list"

android:layout_width="match_parent"

android:layout_height="wrap_content"

>

我们同时还需要一个ListView的一个Item和一个foot用来显示添加的源和实现添加功能,内容如下:

custom_list_item.xml

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:orientation="horizontal" >

android:id="@+id/custom_list_item_name"

android:layout_width="100dp"

android:layout_height="wrap_content"

android:singleLine="true"

android:text="频道"

/>

android:id="@+id/custom_list_item_url"

android:layout_width="match_parent"

android:layout_height="30dp"

android:text="视频源链接"

/>

custom_list_foot.xml

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical" >

android:layout_width="match_parent"

android:layout_height="30dp"

android:text="点击此处添加视频源"

android:textSize="25sp"

/>

我上面只是使用TextView来显示,如果需要美化,可以添加ImageView来实现图文并茂,布局写完后,我们就要添加一个数据库用来记录添加的视频源,为了方便起见,我们还需要定义一个自定义视频内容格式的类,内容如下:

CustomVideo.java

package com.jwzhangjie.live.type;

import java.io.Serializable;

publ

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值