Vitamio打造android个性化得播放器

 在android开发中,视频的播放一般会使用VideoView来处理,但是现在流行一款开源框架即Vitamio,用它可以打造自己开源的个性化播放器,先给大家放上一个参考连接

http://06.hk/Android/71750.html#

    最近项目中开始也用的是VideoView,后来换成了Vitamio,加上了根据手势滑动快进或后退,上下滑动调整音量的效果。。先上两张图

        

       原理其实比较简单。。主要是通过在代码中对布局中view控制显隐来实现,同时同步io.vov.vitamio.widget.VideoView的信息即可


      布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <io.vov.vitamio.widget.VideoView
        android:id="@+id/surface_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />

   <RelativeLayout
        android:id="@+id/gesture_volume_layout"
        android:layout_width="120dip"
        android:layout_height="120dip"
        android:layout_centerInParent="true"
        android:background="@drawable/souhu_player_gesture_bg"
        android:gravity="center"
        android:visibility="invisible" >

        <ImageView
            android:id="@+id/gesture_iv_player_volume"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:src="@drawable/souhu_player_volume" />

        <TextView
            android:id="@+id/geture_tv_volume_percentage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/gesture_iv_player_volume"
            android:layout_centerHorizontal="true"
            android:gravity="right"
            android:text="80%"
            android:textColor="#ffececec" />
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/gesture_progress_layout"
        android:layout_width="120dip"
        android:layout_height="80dip"
        android:layout_centerInParent="true"
        android:background="@drawable/souhu_player_gesture_bg"
        android:gravity="center"
        android:visibility="invisible" >

        <ImageView
            android:id="@+id/gesture_iv_progress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:src="@drawable/souhu_player_backward" />

        <TextView
            android:id="@+id/geture_tv_progress_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/gesture_iv_progress"
            android:layout_centerHorizontal="true"
            android:gravity="right"
            android:text="00:35/24:89"
            android:textColor="#ffececec" />
    </RelativeLayout>


</RelativeLayout>
具体的处理我传到资源里面了。。有详细的说明  :别忘了在SD卡根目录下放一个mp4来做测试

资源的地址http://download.csdn.net/detail/yaya_soft/7129941


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值