title: 基于exoPlayer 自定义播放器
date: 2017-09-05 11:42:05
tags:

  • Android
  • Video
  • ListVideo

基于exoPlayer 自定义播放器 Jplayer支持功能:

  • 1 ExoUserPlayer 基本播放
  • 2 GestureVideoPlayer 增加手势 亮度,音量,快进,等手势
  • 3 ManualPlayer 默认手动播放,增加默认图
  • 5 增加广告视频预览切换
  • 6 增加视频清晰度切换
  • 7 增加缓存视频功能
  • 8 支持自定义各种数据源加载 Okttp,Rtmp, 缓存,Cronet等协议,
  • 9 支持列表播放视频
  • 10 支持多种文件类型,MP4,M4A,WebM,Matroska,Ogg,WAV,MP3,MPEG-TS,MPEG-PS,FLV,ADTS (AAC),Flac,M3U8 等
  • 11 支持网络类型 提示是否播放
    <!–more–>

    预览 显示有点卡,帧数低,实际很流畅

一.引用类库

  <span class="hljs-tag">repositories</span> {
         <span class="hljs-tag">jcenter</span>()
         <span class="hljs-tag">maven</span> { <span class="hljs-attribute">url</span> <span class="hljs-string">"https://jitpack.io"</span> }
     }

 <span class="hljs-tag">dependencies</span> {
    <span class="hljs-attribute">compile</span> <span class="hljs-string">'com.ycjiang:VideoPlayModule:1.4.8'</span>

 }
`</pre>

### 二.控件属性

> #### 1.控件属性引用
<pre>`  <chuangyuan.ycj.videolibrary.widget.VideoPlayerView
        android:<span class="hljs-variable">id=</span><span class="hljs-string">"@+id/exo_play_context_id"</span>
        android:<span class="hljs-variable">layout_width=</span><span class="hljs-string">"match_parent"</span>
        android:<span class="hljs-variable">layout_height=</span><span class="hljs-string">"match_parent"</span>
        android:<span class="hljs-variable">background=</span><span class="hljs-string">"@android:color/transparent"</span>
        app:<span class="hljs-variable">resize_mode=</span><span class="hljs-string">"fit"</span>
        app:<span class="hljs-variable">show_timeout=</span><span class="hljs-string">"3000"</span>
        app:<span class="hljs-variable">controller_layout_id=</span><span class="hljs-string">"@layout/simple_exo_playback_control_view"</span>
        app:<span class="hljs-variable">player_layout_id=</span><span class="hljs-string">"@layout/simple_exo_view"</span>
        app:<span class="hljs-variable">surface_type=</span><span class="hljs-string">"texture_view"</span>
        app:<span class="hljs-variable">use_artwork=</span><span class="hljs-string">"true"</span>
        app:<span class="hljs-variable">paddingEnd=</span><span class="hljs-string">"0dp"</span>
        app:<span class="hljs-variable">paddingStart=</span><span class="hljs-string">"0dp"</span>
        app:<span class="hljs-variable">fastforward_increment=</span><span class="hljs-string">"0"</span>
        app:<span class="hljs-variable">rewind_increment=</span><span class="hljs-string">"0"</span>
        app:<span class="hljs-variable">user_watermark=</span><span class="hljs-string">"@mipmap/watermark_big"</span>
        app:<span class="hljs-variable">player_list=</span><span class="hljs-string">"true"</span>
        app:<span class="hljs-variable">use_controller=</span><span class="hljs-string">"true"</span> ></chuangyuan>
`</pre>

#### 2.属性说明
  1. player_layout_id 播放器布局, //必选>
    `player_layout_id 目前支持指定布局simple_exo_playback_control_view 后续版本,开放自定义使用这自定义
    `</pre>
    
  2. controller_layout_id 控制器布局//必选> <pre>controller_layout_id 支持自定义布局
    `</pre>
    
  3. surface_type 视频渲染类型 //texture_view 和surface_view //枚举类型。默认surface_view >
    列表播放只能选择texture_view 不能选择surface_view,详情页面播放推荐surface_view
  4. use_controller 是否用户控制控制器 布尔类型
  5. resize_mode 视频缩放渲染显示方式一共4种 //可选 美剧类型>
    `    1.fit          //正常模式
        <span class="hljs-number">2</span><span class="hljs-class">.fixed_width</span>  <span class="hljs-comment">//保持的是视频宽度,拉伸视频高度</span>
        <span class="hljs-number">3</span><span class="hljs-class">.fixed_height</span> <span class="hljs-comment">//保持的是视频高度,拉伸视频宽度</span>
        <span class="hljs-number">4</span><span class="hljs-class">.fill</span>          <span class="hljs-comment">//全屏模式,拉伸视频宽高</span>
    `</pre>
    
  6. default_artwork 占位图 //可选>
    ` 占位图 注意在控制布局后下面
    `</pre>
    
  7. show_timeout 控制布局隐藏时间 默认值为3秒 //可选
  8. paddingEnd,paddingStart 设置边距 默认值为0 //可选
  9. fastforward_increment 设置快进增量,以毫秒为单位。 //可选
  10. rewind_increment 设置快退增量,以毫秒为单位。 //可选
  11. user_watermark 水印图片 默认在右上角 //可选
  12. player_list 是否指定列表播放 //可选 默认 false true 列表播放

    3.修改网络对话框提示文字内容

` app.strings.xml
     <string name="exo_play_reminder">您当前网络不是wifi,是否继续观看视频string>
     <string name="exo_play_wifi_hint_no">提示string>
    `
#### 4.在功能清单声明 AndroidManifest.xml

   在activity节点 加上“android:configChanges="orientation|keyboardHidden|screenSize"”
    如下实例:
`      name="chuangyuan.ycj.yjplay.MainListActivity"
           android:configChanges="orientation|keyboardHidden|screenSize"
           android:screenOrientation="portrait">
    `
### 3.JAVA 代码

> #### 1 播放控制类

1.ExoUserPlayer 基本播放父类,实现基本播放,设置setPlayUri();会自动加载播放
2.GestureVideoPlayer 具有手势操作播放(调节亮度和视频进度,和音量)会自动加载播放
2.ManualPlayer 点击开始按钮播放,具有手势功能,和列表播放

#### 2 播放

<pre>`<span class="hljs-comment">//实例化播放控制类</span>
 ManualPlayer exoPlayerManager = <span class="hljs-keyword">new</span> ManualPlayer(<span class="hljs-keyword">this</span>,R.id.exo_play_context_id);
<span class="hljs-comment">//自定义你的数据源,后面详细介绍如何自定义数据源类</span>
 <span class="hljs-comment">// ManualPlayer exoPlayerManager = new ManualPlayer(this,R.id.exo_play_context_id,new DataSource(this));</span>
 <span class="hljs-comment">//加载m3u8</span>
 exoPlayerManager.setPlayUri(<span class="hljs-string">"http://dlhls.cdn.zhanqi.tv/zqlive/35180_KUDhx.m3u8"</span>);
 <span class="hljs-comment">//加载ts.文件</span>
 exoPlayerManager.setPlayUri(<span class="hljs-string">"http://185.73.239.15:25461/live/1/1/924.ts"</span>);
 <span class="hljs-comment">//播放本地视频</span>
 <span class="hljs-comment">// exoPlayerManager.setPlayUri("/storage/emulated/0/DCIM/Camera/VID_20170717_011150.mp4");</span>
 <span class="hljs-comment">//下面开启多线路播放</span>
 <span class="hljs-comment">//  exoPlayerManager.setShowVideoSwitch(true); //开启切换按钮,默认关闭</span>
 <span class="hljs-comment">//String [] test={"http://120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4","http://120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4","http://120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4"};</span>
 <span class="hljs-comment">// String[] name={"超清","高清","标清"};</span>
 <span class="hljs-comment">//exoPlayerManager.setPlaySwitchUri(test,name);</span>
 <span class="hljs-comment">//添加水印图片</span>
 <span class="hljs-comment">// exoPlayerManager.setExoPlayWatermarkImg();</span>
`</pre>
   1.实例化播放控制类

> > <pre>`  ManualPlayer exoPlayerManager = <span class="hljs-keyword">new</span> ManualPlayer(<span class="hljs-keyword">this</span>,R.id.exo_play_context_id);
  ManualPlayer exoPlayerManager = <span class="hljs-keyword">new</span> ManualPlayer(<span class="hljs-keyword">this</span>,videoPlayerView);
`</pre>
   2.自定义你的数据源,后面详细介绍如何自定义数据源类

> > <pre>` ManualPlayer exoPlayerManager = <span class="hljs-keyword">new</span> ManualPlayer(<span class="hljs-keyword">this</span>,R.id.exo_play_context_id,<span class="hljs-keyword">new</span> DataSource(<span class="hljs-keyword">this</span>));
 ManualPlayer exoPlayerManager = <span class="hljs-keyword">new</span> ManualPlayer(<span class="hljs-keyword">this</span>,videoPlayerView,<span class="hljs-keyword">new</span> DataSource(<span class="hljs-keyword">this</span>));
`</pre>
   3.设置视频标题

> > <pre>`  <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">setTitle</span>(<span class="hljs-string">"视频标题"</span>);
`</pre>
   4.添加水印图片

> > <pre>` <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">setExoPlayWatermarkImg</span>(R.mipmap.watermark_big);     
`</pre>
   5.设置开始播放进度      

> > <pre>` exoPlayerManager.<span class="hljs-function"><span class="hljs-title">setPosition</span><span class="hljs-params">(<span class="hljs-number">1000</span>)</span></span>
`</pre>
   6.设置视频路径

> > <pre>` <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">setPlayUri</span>(<span class="hljs-string">"http://dlhls.cdn.zhanqi.tv/zqlive/35180_KUDhx.m3u8"</span>);
 <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">setPlayUri</span>(Uri.<span class="hljs-function">parse</span>(<span class="hljs-string">"http://dlhls.cdn.zhanqi.tv/zqlive/35180_KUDhx.m3u8"</span>));
 <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">setPlayUri</span>(Environment.<span class="hljs-function">getExternalStorageDirectory</span>().<span class="hljs-function">getAbsolutePath</span>()+<span class="hljs-string">"/test.h264"</span>); <span class="hljs-comment">//本地视频</span>
`</pre>
   7.设置多线路播放

> > <pre>`  <span class="hljs-comment">//开启多线路设置,默认关闭 </span>
  exoPlayerManager.setShowVideoSwitch(<span class="hljs-keyword">true</span>);
  <span class="hljs-comment">//支持List列表</span>
  <span class="hljs-built_in">String</span> [] test={<span class="hljs-string">"http://120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4"</span>,
  <span class="hljs-string">"http://120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4"</span>,
   http:<span class="hljs-comment">//120.25.246.21/vrMobile/travelVideo/zhejiang_xuanchuanpian.mp4"};</span>
   <span class="hljs-built_in">String</span>[] name={<span class="hljs-string">"超清"</span>,<span class="hljs-string">"高清"</span>,<span class="hljs-string">"标清"</span>};
   exoPlayerManager.setPlaySwitchUri(test,name);
`</pre>
   8.设置监听回调VideoInfoListener

> > <pre>` <span class="hljs-tag">exoPlayerManager</span><span class="hljs-class">.setVideoInfoListener</span>(new <span class="hljs-function">VideoInfoListener</span>() {
               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onPlayStart</span>() {
                     <span class="hljs-comment">//开始播放</span>
               }

               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onLoadingChanged</span>() {
                         <span class="hljs-comment">//加载变化</span>
               }

               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onPlayerError</span>(ExoPlaybackException e) {
                         <span class="hljs-comment">//加载错误</span>
              }

               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onPlayEnd</span>() {
                      <span class="hljs-comment">//播放结束</span>
               }

               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onBack</span>() {
                   <span class="hljs-comment">//返回回调</span>
                   <span class="hljs-attribute">Toast</span>.<span class="hljs-function">makeText</span>(MainDetailedActivity.this,<span class="hljs-string">"f返回"</span>,Toast.LENGTH_LONG).<span class="hljs-function">show</span>();
                   <span class="hljs-attribute">finish</span>();

               }
               <span class="hljs-variable">@Override</span>
               public void <span class="hljs-function">onRepeatModeChanged</span>(int repeatMode) {
                   <span class="hljs-comment">//模式变化</span>
               }
           });  
`</pre>

   9.覆写Activity和Fragment周期方法 

<pre>`        <span class="hljs-tag">Override</span>
        <span class="hljs-tag">public</span> <span class="hljs-tag">void</span> <span class="hljs-tag">onResume</span>() {
            <span class="hljs-attribute">super</span>.<span class="hljs-function">onResume</span>();
            <span class="hljs-attribute">Log</span>.<span class="hljs-function">d</span>(TAG, <span class="hljs-string">"onResume"</span>);
            <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">onResume</span>();
        }

        <span class="hljs-variable">@Override</span>
        public void <span class="hljs-function">onPause</span>() {
            <span class="hljs-attribute">super</span>.<span class="hljs-function">onPause</span>();
            <span class="hljs-attribute">Log</span>.<span class="hljs-function">d</span>(TAG, <span class="hljs-string">"onPause"</span>);
            <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">onPause</span>();
        }

        <span class="hljs-variable">@Override</span>
        protected void <span class="hljs-function">onDestroy</span>() {
            <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">onDestroy</span>();
            <span class="hljs-attribute">super</span>.<span class="hljs-function">onDestroy</span>();

        }

        <span class="hljs-variable">@Override</span>
        public void <span class="hljs-function">onConfigurationChanged</span>(Configuration newConfig) {
            <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">onConfigurationChanged</span>(newConfig);<span class="hljs-comment">//横竖屏切换</span>
            <span class="hljs-attribute">super</span>.<span class="hljs-function">onConfigurationChanged</span>(newConfig);
        }

        <span class="hljs-variable">@Override</span>
        public void <span class="hljs-function">onBackPressed</span>() {<span class="hljs-comment">//使用播放返回键监听</span>
           <span class="hljs-attribute">exoPlayerManager</span>.<span class="hljs-function">onBackPressed</span>();
        }
`</pre>
### 三.列表

   1.列表播放,只能使用ManualPlayer,在你的VideoHolder
  • 1在列表控件使用属性 ”app:controller_layout_id=”@layout/simple_exo_playback_list_view”“ //提供默列表控制布局
  • 2.player_list=”true” 设置为true 开启列表模式
  • 3.demo:> >

    `     public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VideoViewHolder> {

           <span class="hljs-keyword">private</span> Context mContext;
          <span class="hljs-keyword">private</span> List<String> mVideoList;
          <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">VideoAdapter</span><span class="hljs-params">(Context context, List<String> videoList)</span> </span>{
              mContext = context;
              mVideoList = videoList;
          }
          <span class="hljs-annotation">@Override</span>
          <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">getItemCount</span><span class="hljs-params">()</span> </span>{
              <span class="hljs-keyword">return</span> mVideoList.size();
          }
          <span class="hljs-annotation">@Override</span>
          <span class="hljs-function"><span class="hljs-keyword">public</span> VideoViewHolder <span class="hljs-title">onCreateViewHolder</span><span class="hljs-params">(ViewGroup parent, <span class="hljs-keyword">int</span> viewType)</span> </span>{
              View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_video1, parent, <span class="hljs-keyword">false</span>);
              <span class="hljs-function"><span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-title">VideoViewHolder</span><span class="hljs-params">(itemView)</span></span>;
          }
          <span class="hljs-annotation">@Override</span>
          <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onBindViewHolder</span><span class="hljs-params">(VideoViewHolder holder, <span class="hljs-keyword">int</span> position)</span> </span>{
              String video = mVideoList.get(position);
              holder.bindData(video);
          }
          <span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">VideoViewHolder</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">RecyclerView</span>.<span class="hljs-title">ViewHolder</span> </span>{
              ManualPlayer userPlayer;
              VideoPlayerView playerView;
              <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">VideoViewHolder</span><span class="hljs-params">(View itemView)</span> </span>{
                  <span class="hljs-keyword">super</span>(itemView);
                  <span class="hljs-comment">//初始化控件</span>
                  playerView = (VideoPlayerView) itemView.findViewById(R.id.item_exo_player_view);
                  userPlayer = <span class="hljs-keyword">new</span> ManualPlayer((Activity) mContext, playerView);
              }
             <span class="hljs-javadoc">/**
             *绑定数据源
             ***/</span>
              <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">bindData</span><span class="hljs-params">(String videoBean)</span> </span>{
                  userPlayer.setTitle(<span class="hljs-string">""</span> + getAdapterPosition());
                  userPlayer.setPlayUri(videoBean);
                  Glide.with(mContext)
                  .load(<span class="hljs-string">"http://i3.letvimg.com/lc08_yunzhuanma/201707/29/20/49/3280a525bef381311b374579f360e80a_v2_MTMxODYyNjMw/thumb/2_960_540.jpg"</span>)
                  .into(playerView.getPreviewImage());
              }
          }
    `</pre>
    2.列表播放周期方法 列表在Activity或者Fragment  实现相应周期方法
    <pre>`               <span class="hljs-tag">protected</span> <span class="hljs-tag">void</span> <span class="hljs-tag">onPause</span>() {
                       <span class="hljs-attribute">super</span>.<span class="hljs-function">onPause</span>();
                       <span class="hljs-attribute">VideoPlayerManager</span>.<span class="hljs-function">getInstance</span>().<span class="hljs-function">onPause</span>();
                   }
                   <span class="hljs-variable">@Override</span>
                    protected void <span class="hljs-function">onResume</span>() {
                       <span class="hljs-attribute">super</span>.<span class="hljs-function">onResume</span>();
                       <span class="hljs-attribute">VideoPlayerManager</span>.<span class="hljs-function">getInstance</span>().<span class="hljs-function">onResume</span>();
                   }
                   <span class="hljs-variable">@Override</span>
                   protected void <span class="hljs-function">onDestroy</span>() {
                       <span class="hljs-attribute">super</span>.<span class="hljs-function">onDestroy</span>();
                       <span class="hljs-attribute">VideoPlayerManager</span>.<span class="hljs-function">getInstance</span>().<span class="hljs-function">onDestroy</span>();
                   }
                   <span class="hljs-variable">@Override</span>
                   public void <span class="hljs-function">onBackPressed</span>() {
                       <span class="hljs-comment">//返回监听类</span>
                       <span class="hljs-tag">if</span> (!VideoPlayerManager.<span class="hljs-function">getInstance</span>()<span class="hljs-class">.onBackPressed</span>()){
                           <span class="hljs-attribute">finish</span>();
                       }
                   }    `</pre>
    

    四.数据源工厂类

    1.默认数据源

    `    缓存 : CacheDataSinkFactory,CacheDataSourceFactory
            http : DefaultDataSourceFactory,DefaultHttpDataSourceFactory
            Priority : PriorityDataSourceFactory      
        `
    #### 2 自定义数据源引用
    
    <pre>`<span class="hljs-keyword">compile</span> <span class="hljs-string">'com.google.android.exoplayer:extension-okhttp:r2.5.1'</span>
    <span class="hljs-keyword">compile</span> <span class="hljs-string">'com.google.android.exoplayer:extension-rtmp:r2.5.1'</span>
    `</pre>
    
    #### 3.自定义数据源工厂类:
    
    • 实现接口 DataSourceListener 然后在getDataSourceFactory方法里 自定义 数据源
    • 在你使用播放控件时中实例化类
      exoPlayerManager = new GestureVideoPlayer(this,videoPlayerView,new DataSource(this));
      exoPlayerManager = new GestureVideoPlayer(this,(R.id.exo_play_context_id,new DataSource(this));
  • demo代码:

    `public class DataSource implements DataSourceListener {

          <span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">final</span> String TAG = <span class="hljs-string">"DataSource"</span>;
          <span class="hljs-keyword">private</span> Context context;
           <span class="hljs-function"><span class="hljs-keyword">public</span>   <span class="hljs-title">DataSource</span> <span class="hljs-params">(Context context)</span></span>{
               <span class="hljs-keyword">this</span>.context=context;
           }
          <span class="hljs-annotation">@Override</span>
          <span class="hljs-keyword">public</span> com.google.android.exoplayer2.upstream.DataSource.<span class="hljs-function">Factory <span class="hljs-title">getDataSourceFactory</span><span class="hljs-params">()</span> </span>{
               OkHttpClient  okHttpClient = <span class="hljs-keyword">new</span> OkHttpClient();
               OkHttpDataSourceFactory OkHttpDataSourceFactory=    <span class="hljs-keyword">new</span> OkHttpDataSourceFactory(okHttpClient, Util.getUserAgent(context, context.getApplicationContext().getPackageName()),<span class="hljs-keyword">new</span> DefaultBandwidthMeter() );
                  <span class="hljs-comment">//使用OkHttpClient 数据源工厂</span>
                <span class="hljs-comment">//return  OkHttpDataSourceFactory; ;</span>
                <span class="hljs-comment">//默认数据源工厂</span>
                <span class="hljs-comment">// return new JDefaultDataSourceFactory(context);</span>
                <span class="hljs-comment">// Rtmp数据源工厂 对 Rtmp 协议支持</span>
                <span class="hljs-comment">// return  new RtmpDataSourceFactory();</span>
               <span class="hljs-comment">//缓存使用和组合使用</span>
                LeastRecentlyUsedCacheEvictor evictor = <span class="hljs-keyword">new</span> LeastRecentlyUsedCacheEvictor(<span class="hljs-number">1000000000</span>);
               SimpleCache   simpleCache = <span class="hljs-keyword">new</span> SimpleCache(<span class="hljs-keyword">new</span> File(context.getCacheDir(), <span class="hljs-string">"media"</span>), evictor);
               <span class="hljs-comment">//缓存数据源使用,内部使用DefaultDataSourceFactory数据源工厂类</span>
               <span class="hljs-comment">// return  new CacheDataSinkFactory(simpleCache,10000);</span>
               <span class="hljs-comment">// 配合okHttp数据源工厂类</span>
               <span class="hljs-function"><span class="hljs-keyword">return</span>  <span class="hljs-keyword">new</span> <span class="hljs-title">CacheDataSourceFactory</span><span class="hljs-params">(simpleCache, OkHttpDataSourceFactory)</span></span>;
               <span class="hljs-comment">//使用配合默认数据源红工厂类</span>
               <span class="hljs-comment">// return  new CacheDataSourceFactory(simpleCache, new JDefaultDataSourceFactory(context));</span>
               <span class="hljs-comment">//使用提供缓存数据源工厂类</span>
               <span class="hljs-comment">// return new CacheDataSourceFactory(context,1000,1000);</span>
              }
    `</pre>
       }
    

    五.自定义控制布局

  • 1.使用自定义控制布局 app:controller_layout_id=”@layout/simple_exo_playback_control_view” 详细看 demo> >

    `app:controller_layout_id  指向您的布局名称

    *   **_2.注意自定义控制布局事项 不能改变控件类型,可以改变控件的样式,位置,属性等_**
    

项目地址-戳我

最后更新: 2018年03月09日 22:55

原始链接: http://yangchaojiang.cn/2017/09/05/jPlayer-blog/