杨充 hace 4 años
padre
commit
47cb040ea9

+ 17 - 1
Demo/proguard-rules.pro

@@ -24,4 +24,20 @@
 #ijkplayer
 -keep class tv.danmaku.ijk.media.player.** {*;}
 -keep class tv.danmaku.ijk.media.player.IjkMediaPlayer{*;}
--keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{*;}
+-keep class tv.danmaku.ijk.media.player.ffmpeg.FFmpegApi{*;}
+
+
+# 视频播放器
+# 视频内核
+-keep class com.yc.kernel.**{*;}
+# 视频播放器
+-keep class com.yc.video.**{*;}
+# 视频缓存
+-keep class com.yc.videocache.**{*;}
+# 视频悬浮view
+-keep class com.yc.videoview.**{*;}
+# 视频位置记录
+-keep class com.yc.videosqllite.**{*;}
+# 视频m3u8分片下载和合成
+-keep class com.yc.m3u8.**{*;}
+

+ 14 - 0
Demo/src/main/java/com/yc/ycvideoplayer/BaseApplication.java

@@ -14,6 +14,8 @@ import com.yc.music.utils.MusicSpUtils;
 import com.yc.video.config.VideoPlayerConfig;
 import com.yc.video.player.VideoViewManager;
 import com.yc.video.surface.SurfaceViewFactory;
+import com.yc.videosqllite.manager.CacheConfig;
+import com.yc.videosqllite.manager.LocationManager;
 
 /**
  * ================================================
@@ -72,6 +74,18 @@ public class BaseApplication extends Application {
                 //.setRenderViewFactory(SurfaceViewFactory.create())
                 .build());
         MusicSpUtils.init(this);
+
+        initVideoCache();
+    }
+
+    private void initVideoCache() {
+        CacheConfig cacheConfig = new CacheConfig();
+        cacheConfig.setIsEffective(true);
+        cacheConfig.setType(2);
+        cacheConfig.setContext(this);
+        cacheConfig.setCacheMax(1000);
+        cacheConfig.setLog(false);
+        LocationManager.getInstance().init(cacheConfig);
     }
 
     /**

+ 50 - 0
VideoSqlLite/src/main/java/com/yc/videosqllite/TestDemo.java

@@ -0,0 +1,50 @@
+package com.yc.videosqllite;
+
+import android.content.Context;
+
+import com.yc.videosqllite.manager.CacheConfig;
+import com.yc.videosqllite.manager.LocationManager;
+
+/**
+ * <pre>
+ *     @author yangchong
+ *     email  : yangchong211@163.com
+ *     time  : 2020/6/16
+ *     desc  : 使用代码案例
+ *     revise:
+ * </pre>
+ */
+public class TestDemo {
+
+    private void init(Context context){
+        CacheConfig cacheConfig = new CacheConfig();
+        //设置配置是生效
+        cacheConfig.setIsEffective(true);
+        /*
+         * 0,表示内存缓存
+         * 1,表示磁盘缓存
+         * 2,表示内存缓存+磁盘缓存
+         */
+        cacheConfig.setType(2);
+        //设置上下文
+        cacheConfig.setContext(context);
+        //设置最大缓存
+        cacheConfig.setCacheMax(1000);
+        //设置是否打印log
+        cacheConfig.setLog(false);
+        //初始化
+        LocationManager.getInstance().init(cacheConfig);
+
+
+        //保存播放位置
+//        VideoLocation location = new VideoLocation(url, currentPosition, duration);
+//        LocationManager.getInstance().put(url,location);
+
+        //获取播放位置
+//        final long location = LocationManager.getInstance().get(url);
+
+        //清除所有位置
+//        LocationManager.getInstance().clearAll();
+    }
+
+}

+ 3 - 1
VideoSqlLite/src/main/java/com/yc/videosqllite/model/VideoLocation.java

@@ -165,7 +165,9 @@ public class VideoLocation implements Serializable {
      * @return
      */
     private boolean equals(Object a, Object b) {
-        return (a == b) || (a != null && a.equals(b));
+        boolean ab = (a == b);
+        boolean equal = (a != null && a.equals(b));
+        return ab || equal;
     }
 
     /**