Browse Source

model parse

zhaoyadi 2 years ago
parent
commit
0afe4ec80d

+ 2 - 0
ui/build.gradle

@@ -41,6 +41,8 @@ dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
 
     implementation project(':kit')
+    api 'com.tencent.mm.opensdk:wechat-sdk-android:+'
+    implementation("com.alibaba.fastjson2:fastjson2-kotlin:2.0.12.android")
 
     implementation 'com.tencent.liteav:LiteAVSDK_Player:latest.release'
 

+ 6 - 2
ui/src/main/AndroidManifest.xml

@@ -15,8 +15,7 @@
         <activity
             android:name=".MainActivity"
             android:exported="true"
-            android:theme="@style/PlayerTheme"
-            >
+            android:theme="@style/PlayerTheme">
 
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -52,5 +51,10 @@
             android:screenOrientation="landscape"
             android:theme="@style/AppTheme.Dialog" />
 
+        <activity
+            android:name=".PlayerShare"
+            android:launchMode="singleTop"
+            android:screenOrientation="landscape"
+            android:theme="@style/AppTheme.Dialog" />
     </application>
 </manifest>

+ 588 - 0
ui/src/main/assets/data.json

@@ -0,0 +1,588 @@
+{
+  "id": "1540203667959226370",
+  "name": "小鸡彩虹英文版第二季",
+  "imgCover": "https://img.luojigou.vip/Fmsz81vTpT9iVWuws2tVOuDwI9kY",
+  "imgCoverMini": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-",
+  "createTime": "2022-06-24 13:22:24",
+  "updateTime": "2022-06-24 13:22:56",
+  "price": 6.9,
+  "markingPrice": 7.9,
+  "categoryId": "1533687853001138178",
+  "courseCount": 13,
+  "aiCourseSpuId": "1540203667934060546",
+  "suitAge": "3-6",
+  "wxNumber": null,
+  "wxQrCode": null,
+  "wxName": null,
+  "wxHeadImg": null,
+  "description": "<p><img src=\"https://img.luojigou.vip/FsgZtHx8XTH3cQbwF-5xZbFdc8YG\" /></p>",
+  "mediaType": 0,
+  "simpleDescription": "国内独家首创的彩色水墨画风;严谨的幼儿内容研发体系,全新理念的世界观架构;绿色、健康、零暴力的内容!",
+  "sort": 998,
+  "showChapter": 0,
+  "courseType": 0,
+  "subCategoryId": "1533687853001138178",
+  "activityTag": null,
+  "courseTags": [],
+  "paidCount": 2,
+  "latestLearnedRecordId": null,
+  "latestLearnedRecord": null,
+  "abilityList": [],
+  "commentCount": 0,
+  "shareCount": 22,
+  "collectCount": 1,
+  "isCollect": 0,
+  "hasPaid": 0,
+  "isComment": 0,
+  "isShare": 0,
+  "imgCoverWidth": null,
+  "imgCoverHeight": null,
+  "shareUrl": "https://zaojiao.net/luojigou_web_shop_html/#/growTogether/group/course?id=1540203667959226370",
+  "shareUrlQRCode": "http://app.zaojiao.net//QRCode/aiCourse/sku?id=1540203667959226370",
+  "groupBuyActivity": null,
+  "groupBuyActivityId": null,
+  "groupBuyActivityUrl": null,
+  "show_cover_img": 0,
+  "spu": {
+    "id": "1540203667934060546",
+    "name": "小鸡彩虹英文版第二季",
+    "imgCover": "https://img.luojigou.vip/Fmsz81vTpT9iVWuws2tVOuDwI9kY",
+    "imgCoverMini": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-",
+    "videoUrl": null,
+    "createTime": "2022-06-24 13:22:24",
+    "updateTime": "2022-06-24 13:22:56",
+    "price": 6.9,
+    "markingPrice": 7.9,
+    "categoryId": "1533687853001138178",
+    "suitAge": "3-6",
+    "parentNotice": null,
+    "courseCount": 13,
+    "description": null,
+    "outline": null,
+    "notice": null,
+    "simpleDescription": "国内独家首创的彩色水墨画风;严谨的幼儿内容研发体系,全新理念的世界观架构;绿色、健康、零暴力的内容!",
+    "mediaType": 0,
+    "status": 1,
+    "isDelete": 0,
+    "sort": 998,
+    "showChapter": 0,
+    "isShow": true,
+    "showCoverImg": 0
+  },
+  "totalStarCount": 0,
+  "getStarCount": 0,
+  "chapterList": [
+    {
+      "id": "1540205198192320513",
+      "name": "第1章",
+      "createTime": "2022-06-24 13:28:29",
+      "updateTime": null,
+      "aiCourseSkuId": "1540203667959226370",
+      "sort": 0,
+      "coverImgUrl": null,
+      "itemList":[
+        {
+          "id": "1540205198213292034",
+          "name": "01 大苹果The Large Apple",
+          "videoId": "1540205198259429378",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 0,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-08-09 12:50:03",
+          "readCount": 622,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 1,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "622",
+          "video": {
+            "id": "1540205198259429378",
+            "videoUrl": "http://video.training.luojigou.vip/lm6giVlUMxuYKuVaBRTxRr6SNiO__low.mp4",
+            "parentId": "1540205198213292034",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lm6giVlUMxuYKuVaBRTxRr6SNiO__low.mp4?vframe/jpg/offset/1",
+            "duration": "291.280000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198318149634",
+          "name": "02 堆云朵Building a Cloudman",
+          "videoId": "1540205198364286977",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 1,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-08-06 12:55:46",
+          "readCount": 57,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "57",
+          "video": {
+            "id": "1540205198364286977",
+            "videoUrl": "http://video.training.luojigou.vip/lgkv47QjbYuMaH8CCPR-uPAvlGQG_low.mp4",
+            "parentId": "1540205198318149634",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lgkv47QjbYuMaH8CCPR-uPAvlGQG_low.mp4?vframe/jpg/offset/1",
+            "duration": "292.080000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198423007233",
+          "name": "03 小青的烦恼Berry’s Worries",
+          "videoId": "1540205198464950273",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 2,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-08-02 17:29:18",
+          "readCount": 32,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "32",
+          "video": {
+            "id": "1540205198464950273",
+            "videoUrl": "http://video.training.luojigou.vip/lrf7sm2fUhLLL1rgCu2vykWG2H9j_low.mp4",
+            "parentId": "1540205198423007233",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lrf7sm2fUhLLL1rgCu2vykWG2H9j_low.mp4?vframe/jpg/offset/1",
+            "duration": "290.080000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198523670529",
+          "name": "04 放风筝Flying a Kite",
+          "videoId": "1540205198565613570",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 3,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-08-09 12:43:05",
+          "readCount": 16,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "16",
+          "video": {
+            "id": "1540205198565613570",
+            "videoUrl": "http://video.training.luojigou.vip/lmgfP9zPh_Fi8y_shUI9TuZ9pGA9_low.mp4",
+            "parentId": "1540205198523670529",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:50",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lmgfP9zPh_Fi8y_shUI9TuZ9pGA9_low.mp4?vframe/jpg/offset/1",
+            "duration": "287.240000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198624333825",
+          "name": "05 小绿的愿望Kiwi’s Wish",
+          "videoId": "1540205198670471170",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 4,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-08-09 13:13:41",
+          "readCount": 6,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "6",
+          "video": {
+            "id": "1540205198670471170",
+            "videoUrl": "http://video.training.luojigou.vip/lhIrLQh-hM1-l5omFIOBNhbG8muQ_low.mp4",
+            "parentId": "1540205198624333825",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:51",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lhIrLQh-hM1-l5omFIOBNhbG8muQ_low.mp4?vframe/jpg/offset/1",
+            "duration": "291.880000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198724997121",
+          "name": "06 花裙子Berry’s Flower Skirt",
+          "videoId": "1540205198771134465",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 5,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-07-27 11:07:49",
+          "readCount": 2,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "2",
+          "video": {
+            "id": "1540205198771134465",
+            "videoUrl": "http://video.training.luojigou.vip/ljLcQ-ep4V2yivI_84uMFvtMff79_low.mp4",
+            "parentId": "1540205198724997121",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/ljLcQ-ep4V2yivI_84uMFvtMff79_low.mp4?vframe/jpg/offset/1",
+            "duration": "299.960000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198829854722",
+          "name": "07 小蓝的发掘调查Indigo’s Big Discovery",
+          "videoId": "1540205198871797762",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 6,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-07-27 11:07:52",
+          "readCount": 2,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "2",
+          "video": {
+            "id": "1540205198871797762",
+            "videoUrl": "http://video.training.luojigou.vip/lpYVg1k1-cGqE9eNGgMcbgwzJOa6_low.mp4",
+            "parentId": "1540205198829854722",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:50",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lpYVg1k1-cGqE9eNGgMcbgwzJOa6_low.mp4?vframe/jpg/offset/1",
+            "duration": "291.480000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205198930518018",
+          "name": "08 传说中的那个The Legendary Food",
+          "videoId": "1540205198976655361",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 7,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-07-27 11:07:55",
+          "readCount": 2,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "2",
+          "video": {
+            "id": "1540205198976655361",
+            "videoUrl": "http://video.training.luojigou.vip/lp70IUefTAFIslanq_5bJ_vcuHZd_low.mp4",
+            "parentId": "1540205198930518018",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:50",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lp70IUefTAFIslanq_5bJ_vcuHZd_low.mp4?vframe/jpg/offset/1",
+            "duration": "291.680000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205199031181313",
+          "name": "09 小青的画Cherry the Model",
+          "videoId": "1540205199073124354",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 8,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-06-24 13:28:29",
+          "readCount": 0,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "0",
+          "video": {
+            "id": "1540205199073124354",
+            "videoUrl":  "http://video.training.luojigou.vip/lr28B5Byl9PEFGylOH_n_Al44SDF_low.mp4",
+            "parentId": "1540205199031181313",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:51",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lr28B5Byl9PEFGylOH_n_Al44SDF_low.mp4?vframe/jpg/offset/1",
+            "duration": "298.440000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205199131844609",
+          "name": "10 超级机器人Super Robot",
+          "videoId": "1540205199173787649",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 9,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-07-26 19:31:15",
+          "readCount": 1,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "1",
+          "video": {
+            "id": "1540205199173787649",
+            "videoUrl": "http://video.training.luojigou.vip/lgz9HWomQyGqiRQyC54XtszNqoDE_low.mp4",
+            "parentId": "1540205199131844609",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lgz9HWomQyGqiRQyC54XtszNqoDE_low.mp4?vframe/jpg/offset/1",
+            "duration": "286.040000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205199232507905",
+          "name": "11 茶博士Indigo the Tea Specialist",
+          "videoId": "1540205199274450945",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 10,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-06-24 13:28:29",
+          "readCount": 0,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "0",
+          "video": {
+            "id": "1540205199274450945",
+            "videoUrl": "http://video.training.luojigou.vip/lmlTyVXGYYcCR0wqkHavArlomjOu_low.mp4",
+            "parentId": "1540205199232507905",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lmlTyVXGYYcCR0wqkHavArlomjOu_low.mp4?vframe/jpg/offset/1",
+            "duration": "294.440000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205199333171201",
+          "name": "12 小青的杂货铺Berry the Vendor",
+          "videoId": "1540205199375114242",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 11,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-07-27 11:08:22",
+          "readCount": 3,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "3",
+          "video": {
+            "id": "1540205199375114242",
+            "videoUrl": "http://video.training.luojigou.vip/lkocOh0FKD1IheDFdhTheGs9zyJo_low.mp4",
+            "parentId": "1540205199333171201",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:51",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lkocOh0FKD1IheDFdhTheGs9zyJo_low.mp4?vframe/jpg/offset/1",
+            "duration": "291.080000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        },
+        {
+          "id": "1540205199433834497",
+          "name": "13 大蛋糕The Big Cake",
+          "videoId": "1540205199475777537",
+          "aiCourseSkuId": "1540203667959226370",
+          "sort": 12,
+          "createTime": "2022-06-24 13:28:29",
+          "updateTime": "2022-06-24 13:28:29",
+          "readCount": 0,
+          "aiCourseItemChapterId": "1540205198192320513",
+          "type": 0,
+          "payType": 0,
+          "freeTime": 0,
+          "audioId": null,
+          "imgCover": "https://img.luojigou.vip/FnV8CLD1Ci-oF2SAiDERZ6yV7Ez-?imageView2/0/q/50|imageslim",
+          "richText": null,
+          "splitList": null,
+          "hasReport": 1,
+          "clockInUserCount": "0",
+          "enable": 1,
+          "hasReply": 0,
+          "totalStarCount": 0,
+          "starList": [],
+          "readCountStr": "0",
+          "video": {
+            "id": "1540205199475777537",
+            "videoUrl": "http://video.training.luojigou.vip/lvw30_qJPHQOLC5-mAW1gO4_CpJ9_low.mp4",
+            "parentId": "1540205199433834497",
+            "createTime": "2022-06-24 13:28:29",
+            "updateTime": "2022-06-24 14:15:52",
+            "width": 1920,
+            "height": 1080,
+            "thumbnailUrl": "http://video.training.luojigou.vip/lvw30_qJPHQOLC5-mAW1gO4_CpJ9_low.mp4?vframe/jpg/offset/1",
+            "duration": "291.680000"
+          },
+          "hasClockIn": 0,
+          "getStarCount": 0
+        }
+      ]
+    }
+
+  ],
+  "videoUrl": null
+}
+
+
+
+
+

+ 7 - 17
ui/src/main/java/com/tencent/liteav/demo/player/util/ModelCourse.java

@@ -3,25 +3,20 @@ package com.tencent.liteav.demo.player.util;
 import java.util.ArrayList;
 
 public class ModelCourse {
-    public static class ChapterList{
+    public static class ChapterList {
         public String id;
         public String name;
-        public String createTime;
-        public Object updateTime;
         public String aiCourseSkuId;
-        public int sort;
-        public Object coverImgUrl;
+        public String coverImgUrl;
         public ArrayList<ItemList> itemList;
     }
 
-    public static class ItemList{
+    public static class ItemList {
         public String id;
         public String name;
         public String videoId;
         public String aiCourseSkuId;
         public int sort;
-        public String createTime;
-        public String updateTime;
         public int readCount;
         public String aiCourseItemChapterId;
         public int type;
@@ -43,7 +38,7 @@ public class ModelCourse {
         public int getStarCount;
     }
 
-    public static class Course{
+    public static class Course {
         public String id;
         public String name;
         public String imgCover;
@@ -95,7 +90,7 @@ public class ModelCourse {
         public Object videoUrl;
     }
 
-    public static class Spu{
+    public static class Spu {
         public String id;
         public String name;
         public String imgCover;
@@ -122,16 +117,11 @@ public class ModelCourse {
         public int showCoverImg;
     }
 
-    public static class Video{
+    public static class Video {
         public String id;
         public String videoUrl;
-        public String parentId;
-        public String createTime;
-        public String updateTime;
-        public int width;
-        public int height;
         public String thumbnailUrl;
-        public String duration;
+        public double duration;
     }
 
 

+ 7 - 0
ui/src/main/java/com/tencent/liteav/demo/player/util/ModelParser.java

@@ -1,4 +1,11 @@
 package com.tencent.liteav.demo.player.util;
 
+import com.alibaba.fastjson2.JSONObject;
+import com.google.gson.Gson;
+
 public class ModelParser {
+    public static void parse(String data) {
+        ModelCourse.Course course = JSONObject.parseObject(data, ModelCourse.Course.class);
+        ModelProvider.INSTANCE.setData(course);
+    }
 }

+ 28 - 33
ui/src/main/java/com/tencent/liteav/demo/player/util/ModelProvider.kt

@@ -1,40 +1,35 @@
-package com.tencent.liteav.demo.player.util;
+package com.tencent.liteav.demo.player.util
 
-import com.tencent.liteav.demo.superplayer.SuperPlayerModel;
+import com.tencent.liteav.demo.player.util.ModelCourse.Course
+import com.tencent.liteav.demo.superplayer.SuperPlayerModel
 
-import java.util.ArrayList;
-import java.util.List;
+object ModelProvider {
+    private lateinit var course: Course
 
-public class ModelProvider {
-    private static final String VIDEO_URL = "https://www.douyin.com/aweme/v1/play/?video_id=v0200fg10000cc5ca8bc77u6euo714d0&line=0&file_id=9c767801265548eaac539800298114a9&sign=c2faa0a73f75bef995e495c4d6688e00&is_play_url=1&source=PackSourceEnum_FEED&aid=6383";
-
-    private static final String COVER_URL = "https://p9-pc-sign.douyinpic.com/tos-cn-p-0015/57aaf7f5975247e09c3df35e152055e4_1654159193~tplv-dy-360p.jpeg?biz_tag=pcweb_cover&from=4257465056&se=false&x-expires=1662015600&x-signature=0uL3qAHjGGcvaNmDuopeSCKdfm8%3D";
-
-    private ModelProvider() {
+    fun setData(course: Course) {
+        this.course = course
     }
 
-    public static String getCourseId() {
-        return "123";
-    }
-
-    public static List<SuperPlayerModel> getList() {
-        List<SuperPlayerModel> list = new ArrayList<>();
-
-        for (int i = 0; i < 90; i++) {
-            SuperPlayerModel model = new SuperPlayerModel();
-            model.title = "测试视频" + i;
-            model.duration = 1222;
-            model.isEnableCache = true;
-            model.url = VIDEO_URL;
-            model.sectionId = String.valueOf(i);
-
-            if (i % 2 == 0) {
-                model.cover = COVER_URL;
+    val courseId: String get() = course.id
+
+    val list: List<SuperPlayerModel>
+        get() {
+            val list: MutableList<SuperPlayerModel> = ArrayList()
+
+            for (chapter in course.chapterList) {
+                for (section in chapter.itemList) {
+                    val model = SuperPlayerModel()
+                    model.title = section.name
+                    model.duration = section.video.duration.toInt()
+                    model.isEnableCache = true
+                    model.url = section.video.videoUrl
+                    model.sectionId = section.id
+                    model.cover = section.imgCover
+                    list.add(model)
+                }
             }
-            list.add(model);
-        }
 
-        list.get(list.size() - 1).isLast = true;
-        return list;
-    }
-}
+            list[list.size - 1].isLast = true
+            return list
+        }
+}

+ 24 - 2
ui/src/main/kotlin/com/tencent/liteav/demo/player/MainActivity.kt

@@ -8,6 +8,12 @@ import android.view.ViewGroup
 import android.widget.Button
 import android.widget.LinearLayout
 import androidx.appcompat.app.AppCompatActivity
+import com.tencent.liteav.demo.player.util.ModelParser
+import com.tencent.liteav.demo.player.util.ModelProvider
+import java.io.ByteArrayOutputStream
+import java.io.File
+import java.io.FileInputStream
+import java.io.InputStream
 
 class MainActivity : AppCompatActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
@@ -19,8 +25,24 @@ class MainActivity : AppCompatActivity() {
         val linearLayout = LinearLayout(this@MainActivity).apply {
             val button = Button(this@MainActivity).apply {
                 setOnClickListener {
-                    val intent = Intent(this@MainActivity, PlayerActivity::class.java)
-                    startActivity(intent)
+                    var inputStream: InputStream? = null
+                    var outputStream: ByteArrayOutputStream? = null
+
+                    try {
+                        assets.open("data.json").bufferedReader().use {
+                            val data = it.readText()
+                            ModelParser.parse(data)
+                        }
+
+                        val intent = Intent(this@MainActivity, PlayerActivity::class.java)
+                        startActivity(intent)
+                    } catch (e: Throwable) {
+                        e.printStackTrace()
+                    } finally {
+                        inputStream?.close()
+                        outputStream?.close()
+                    }
+
                 }
 
                 text = "进入播放器"

+ 2 - 2
ui/src/main/kotlin/com/tencent/liteav/demo/player/PlayerActivity.kt

@@ -59,7 +59,7 @@ class PlayerActivity : AppCompatActivity(),
 
     private val viewModel by viewModels<PlayerViewModel> {
         PlayerViewModelFactory(
-            ModelProvider.getCourseId(),
+            ModelProvider.courseId,
             ((application) as PlayerDatabaseProvider).getPlayerRepository()
         )
     }
@@ -205,7 +205,7 @@ class PlayerActivity : AppCompatActivity(),
     private fun updateList() {
         mVodPlayerListAdapter.clear()
 
-        val list = ModelProvider.getList();
+        val list = ModelProvider.list;
         for (videoModel in list) {
             mVodPlayerListAdapter.addSuperPlayerModel(videoModel)
         }

+ 3 - 0
ui/src/main/kotlin/com/tencent/liteav/demo/player/PlayerMenu.kt

@@ -83,6 +83,9 @@ class PlayerMenu : AppCompatActivity(), View.OnClickListener, CoroutineScope by
                 }
             }
             R.id.menu_item_share -> {
+                val intent = Intent(this, PlayerShare::class.java)
+                startActivity(intent)
+                finish()
             }
             R.id.menu_item_timer -> {
                 val intent = Intent(this, PlayerTimer::class.java)

+ 105 - 0
ui/src/main/kotlin/com/tencent/liteav/demo/player/PlayerShare.kt

@@ -0,0 +1,105 @@
+package com.tencent.liteav.demo.player
+
+import android.os.Bundle
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowManager
+import android.widget.ImageView
+import android.widget.RelativeLayout
+import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.constraintlayout.widget.ConstraintLayout
+import com.tencent.liteav.demo.player.ui.MenuItemView
+
+class PlayerShare : AppCompatActivity() {
+    private lateinit var shareFriend: MenuItemView
+    private lateinit var shareTimeline: MenuItemView
+    private lateinit var backButton: ImageView
+
+    private val shareContext get() = this@PlayerShare
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(createView())
+
+        window.setLayout(
+            WindowManager.LayoutParams.MATCH_PARENT,
+            WindowManager.LayoutParams.MATCH_PARENT,
+        )
+    }
+
+    private fun createView(): View {
+        val root = RelativeLayout(shareContext).apply {
+            layoutParams = ViewGroup.LayoutParams(
+                ViewGroup.LayoutParams.MATCH_PARENT,
+                ViewGroup.LayoutParams.MATCH_PARENT,
+            )
+
+            val subRoot = ConstraintLayout(shareContext).apply {
+                layoutParams = RelativeLayout.LayoutParams(
+                    shareContext.resources.getDimension(R.dimen.layour_share_width).toInt(),
+                    ViewGroup.LayoutParams.MATCH_PARENT,
+                ).apply {
+                    addRule(RelativeLayout.ALIGN_PARENT_RIGHT)
+                }
+
+                val parent = this
+
+                background =
+                    AppCompatResources.getDrawable(shareContext, R.drawable.menu_background)
+
+
+                backButton = ImageView(shareContext).apply {
+                    setImageResource(R.mipmap.item_back)
+
+                    id = View.generateViewId()
+                    layoutParams = ConstraintLayout.LayoutParams(
+                        shareContext.resources.getDimension(R.dimen.menu_back_width).toInt(),
+                        shareContext.resources.getDimension(R.dimen.menu_back_height).toInt(),
+                    ).apply {
+                        leftToLeft = parent.id
+                        topToTop = parent.id
+                        bottomToBottom = parent.id
+                    }
+                }
+
+                shareFriend = MenuItemView(shareContext).apply {
+                    setTitle("微信")
+                    setIcon(R.mipmap.item_favorite)
+                    id = View.generateViewId()
+
+                    layoutParams = ConstraintLayout.LayoutParams(
+                        ViewGroup.LayoutParams.WRAP_CONTENT,
+                        ViewGroup.LayoutParams.WRAP_CONTENT,
+                    ).apply {
+                        leftToRight = backButton.id
+                        topToTop = parent.id
+                    }
+                }
+
+                shareTimeline = MenuItemView(shareContext).apply {
+                    setTitle("朋友圈")
+                    setIcon(R.mipmap.item_favorited)
+                    id = View.generateViewId()
+
+                    layoutParams = ConstraintLayout.LayoutParams(
+                        ViewGroup.LayoutParams.WRAP_CONTENT,
+                        ViewGroup.LayoutParams.WRAP_CONTENT,
+                    ).apply {
+                        leftToRight = shareFriend.id
+                        topToTop = parent.id
+                    }
+                }
+
+
+                addView(backButton)
+                addView(shareFriend)
+                addView(shareTimeline)
+            }
+
+            addView(subRoot)
+        }
+
+        return root
+    }
+}

+ 12 - 5
ui/src/main/kotlin/com/tencent/liteav/demo/player/http/AuthorizationInterceptor.kt

@@ -5,14 +5,11 @@ import android.os.Build
 import com.tencent.liteav.demo.superplayer.util.HttpUtils
 import okhttp3.Interceptor
 import okhttp3.Response
+import okhttp3.ResponseBody.Companion.toResponseBody
 
 class AuthorizationInterceptor : Interceptor {
     private var token: String? = null
 
-    companion object {
-        const val error = "{}"
-    }
-
     override fun intercept(chain: Interceptor.Chain): Response {
         if (token == null) {
             val application = HttpUtils.getApplication()
@@ -30,6 +27,16 @@ class AuthorizationInterceptor : Interceptor {
             .addHeader("token", token ?: "")
             .build()
 
-        return chain.proceed(newRequest)
+        return try {
+            chain.proceed(newRequest)
+        } catch (e: Throwable) {
+            Response.Builder().body(
+                internalError(e.message ?: "网络错误").toResponseBody()
+            ).build()
+        }
+    }
+
+    private fun internalError(message: String): String {
+        return "{\"status\":500,\"data\":null,\"msg\":\"${message}\"}".trimIndent()
     }
 }

+ 4 - 0
ui/src/main/res/values/dimens.xml

@@ -9,4 +9,8 @@
     <dimen name="verify_button_width">41dp</dimen>
     <dimen name="verify_button_height">43dp</dimen>
     <dimen name="verify_button_bg_height">39dp</dimen>
+
+    <dimen name="layour_share_width">268dp</dimen>
+    <dimen name="menu_back_width">27dp</dimen>
+    <dimen name="menu_back_height">80dp</dimen>
 </resources>