自定义本地视频播放器

电脑杂谈  发布时间:2020-06-07 06:03:19  来源:网络整理

微商卖什么赚钱看视频播放蓝月传奇_能看本地视频的播放器_以前看见过一款在手机主界面上播放视频的视频播发器

该公司的智能设备需要添加视频播放功能能看本地视频的播放器,该功能不需要播放,并且视频相对较小,因此一些播放库没有使用. 简单地写一个本地播放器~~功能比较简单能看本地视频的播放器,直接编码,

微商卖什么赚钱看视频播放蓝月传奇_能看本地视频的播放器_以前看见过一款在手机主界面上播放视频的视频播发器

使用MediaPlayer + SurfaceView. 由于还使用了本地VideoView,但是对视频格式的限制相对较大,因此使用MediaPlayer会比较麻烦.

微商卖什么赚钱看视频播放蓝月传奇_能看本地视频的播放器_以前看见过一款在手机主界面上播放视频的视频播发器

<?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:background="@color/black">
    <SurfaceView
        android:id="@+id/svVideo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true" />
    <TextView
        android:id="@+id/tvBack"
        android:layout_width="match_parent"
        android:layout_height="120px"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/shape_video_top"
        android:drawableLeft="@drawable/video_back"
        android:gravity="center"
        android:paddingLeft="30px" />
    <RelativeLayout
        android:id="@+id/rlVideoBottom"
        android:layout_width="match_parent"
        android:layout_height="120px"
        android:layout_alignParentBottom="true"
        android:background="@drawable/shape_video_bottom"
        android:visibility="visible">
        <ImageView
            android:id="@+id/ivVideoControl"
            android:layout_width="56px"
            android:layout_height="56px"
            android:layout_centerVertical="true"
            android:layout_marginLeft="60px"
            android:src="@drawable/video_play_s" />
        <TextView
            android:id="@+id/tvVideoStart"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="54px"
            android:layout_toRightOf="@+id/ivVideoControl"
            android:text="00:00:00"
            android:textColor="@color/white"
            android:textSize="28px" />
        <SeekBar
            android:id="@+id/sbVideo"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="30px"
            android:layout_marginRight="30px"
            android:layout_toLeftOf="@+id/tvVideoEnd"
            android:layout_toRightOf="@id/tvVideoStart" />
        <TextView
            android:id="@+id/tvVideoEnd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="54px"
            android:layout_marginRight="30px"
            android:text="00:00:00"
            android:textColor="@color/white"
            android:textSize="28px" />
    </RelativeLayout>
    <ImageView
        android:id="@+id/ivVideoControlBig"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/video_play"
        android:visibility="visible" />
</RelativeLayout>


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/bofangqi/article-236832-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...