Przeglądaj źródła

改更为高版本ijkplayer

onecold 9 miesięcy temu
rodzic
commit
67ea36412d

+ 9 - 7
build-profile.json5

@@ -4,8 +4,10 @@
       {
         "name": "default",
         "signingConfig": "default",
-        "targetSdkVersion": "5.0.5(17)",
+        "targetSdkVersion": "6.0.0(20)",
+        //应用运行的目标SDK版本
         "compatibleSdkVersion": "5.0.5(17)",
+        //应用运行的最低SDK版本
         "runtimeOS": "HarmonyOS",
         "buildOption": {
           "strictMode": {
@@ -29,9 +31,9 @@
         "type": "HarmonyOS",
         "material": {
           "storeFile": "D:/signapk/harmony/qimeng.p12",
-          "storePassword": "00000018259B99D7ED11C858DBF23FA5648A8A3CF72347E1089C32ABFC96EE8DA49B067F943EB2C2",
+          "storePassword": "0000001895C1DF7341A3D39B9EA2160110BE9FFF88F9C3D0226FC33335280A24A8227CEE1A6ABAB9",
           "keyAlias": "qimeng",
-          "keyPassword": "00000018CC7C6D1CED6673D19B405C7078FF7A97E76252C3F7CFC06AC8AF3B3C9CA870D30605BE86",
+          "keyPassword": "00000018A8CF95689193A705494C836B497FC688013ECF5AD86555103A47DACAD081BC72930BA1DC",
           "signAlg": "SHA256withECDSA",
           "profile": "D:/signapk/harmony/qimeng/天天静听调试Debug.p7b",
           "certpath": "D:/signapk/harmony/qimeng/onecold.cer"
@@ -52,10 +54,10 @@
         }
       ]
     },
-    {
-      "name": "ijkplayer",
-      "srcPath": "./ijkplayer"
-    },
+//    {
+//      "name": "ijkplayer",
+//      "srcPath": "./ijkplayer"
+//    },
     ////注释掉这个代码,用ohpm install @ohos/ijkplayer去装2.0.6版本
     {
       "name": "lib",

+ 1 - 1
entry/oh-package.json5

@@ -6,7 +6,7 @@
   "author": "",
   "license": "LGPLv2.1 or later",
   "dependencies": {
-    "@ohos/ijkplayer": "file:../ijkplayer",//注释掉这个代码,用ohpm install @ohos/ijkplayer去装2.0.6版本
+    //"@ohos/ijkplayer": "file:../ijkplayer",//注释掉这个代码,用ohpm install @ohos/ijkplayer去装2.0.6版本
 //    "@csj/openadsdk": "file:libs/openadsdk_6.7.0.har",
     "@tencent/wechat_open_sdk": "1.0.0"
   }

+ 3 - 0
entry/src/main/ets/common/constants/EventConstants.ets

@@ -50,4 +50,7 @@ export class EventConstants {
 
   // 刷新播放列表的排序
   static readonly EVENT_PLAYLIST_REFRESH_SORT: number = 2004;
+
+  // 播放暂停事件(比如hicar断开后,手机不播放了)
+  static readonly EVENT_PLAY_PAUSE: number = 2005;
 }

+ 2 - 0
entry/src/main/ets/entryability/EntryAbility.ets

@@ -366,6 +366,8 @@ export default class EntryAbility extends UIAbility {
                         AppStorage.setOrCreate('isHiCarStatus', true);
                     }else{
                         AppStorage.setOrCreate('isHiCarStatus', false);
+                        const eventData: emitter.EventData = {};
+                        emitter.emit({ eventId: EventConstants.EVENT_PLAY_PAUSE }, eventData); // 发送广播通知更新doSwipBack
                     }
                     this.sendChangeEvent()
                 };

+ 20 - 10
entry/src/main/ets/view/LocalMusic.ets

@@ -48,7 +48,7 @@ import { repairAudioMetadata, convertDsfToWav, getApiLyric,changeMusicCover} fro
 import { FFMpegTags,Utility } from '../common/util/Utility';
 import { TagsContentCover } from '../view/TagsContentCover';
 import {
-  // DeviceChangeReason,
+  DeviceChangeReason,
   IjkMediaPlayer,
   InterruptEvent,
   InterruptHintType,
@@ -1057,13 +1057,23 @@ export struct LocalMusic {
     }
     this.mIjkMediaPlayer.on('audioInterrupt', event);
     // 音频设备断连回调处理
-    // let deviceChangeEvent: Callback<InterruptEvent> = (event) => {
-    //   LogUtils.getInstance().LOGI(`Heanup deviceChange event: ${JSON.stringify(event)}`);
-    //   if (event.reason === DeviceChangeReason.REASON_OLD_DEVICE_UNAVAILABLE) { // 音频设备断开连接
-    //     this.pause();
-    //   }
-    // }
-    // this.mIjkMediaPlayer.on('deviceChange', deviceChangeEvent);
+    let deviceChangeEvent: Callback<InterruptEvent> = (event) => {
+      LogUtils.getInstance().LOGI(`Heanup deviceChange event: ${JSON.stringify(event)}`);
+      if (event.reason === DeviceChangeReason.REASON_NEW_DEVICE_AVAILABLE) { // 音频设备连接
+
+      } else if (event.reason === DeviceChangeReason.REASON_OLD_DEVICE_UNAVAILABLE) { // 音频设备断开连接
+        this.pause();
+      }
+    }
+    // 订阅音频设备断开和连接事件
+    this.mIjkMediaPlayer.on('deviceChange', deviceChangeEvent);
+
+    const eventPause: emitter.InnerEvent = { eventId: EventConstants.EVENT_PLAY_PAUSE }
+    // 监听广播事件(hicar断开暂停播放)
+    emitter.on(eventPause, (eventData: emitter.EventData) => {
+      this.pause();
+
+    });
 
 
     this.makeWorker()
@@ -12569,9 +12579,9 @@ export struct LocalMusic {
   //startOffset 从cue分轨时间开始播
   private startPlayOrResumePlay(startOffset?:number) {
 
-    //针对dsf文件高采样率sampleRate>441000,统一转wav播放
+    //针对dsf文件高采样率,统一转wav播放
     const sampleRate = this.currentSong?.sampleRate||0
-    if(this.videoUrl.toLowerCase().endsWith('.dsf')&&sampleRate>=441000){
+    if(this.videoUrl.toLowerCase().endsWith('.dsf')){
       console.info('onecold 采样率 ='+sampleRate)
       let newDsfPath = this.context.filesDir + '/'+FileUtil.getFileName(this.videoUrl)+'.wav'
       console.info('onecold newDsfPath ='+newDsfPath)

+ 2 - 1
oh-package.json5

@@ -25,7 +25,8 @@
     "@ohos/lottie": "^2.0.23",
     "@mcui/mccharts": "^2.8.9",
     "@nutpi/chinese_transverter": "^1.0.4",
-    "@abner/track": "^1.0.2"
+    "@abner/track": "^1.0.2",
+    "@ohos/ijkplayer": "2.0.7-rc.5"
   },
   "dynamicDependencies": {}
 }