Ver código fonte

修复跳转到设置界面的bug

onecold 1 ano atrás
pai
commit
921de10ce6

+ 5 - 3
entry/src/main/ets/pages/ScanFilePage.ets

@@ -33,6 +33,7 @@ export struct ScanFilePage{
   @State isStartCover:boolean = false
   @State isStartSync:boolean = false
   @State appName:string = ''
+  @Consume mType: number;
   //lottie动画构建渲染上下文
   private mainRenderingSettings: RenderingContextSettings = new RenderingContextSettings(true)
   private path:string = "common/lottie/leida.json"
@@ -424,9 +425,10 @@ export struct ScanFilePage{
           .margin({ left: 6 })
           .onClick(() => {
             DialogHelper.closeDialog('tips'); //关闭弹框
-            router.pushUrl({
-              url: 'pages/SettingPage'
-            }, router.RouterMode.Single);
+            this.mType = 3
+            // router.pushUrl({
+            //   url: 'pages/SettingPage'
+            // }, router.RouterMode.Single);
           })
       }
 

+ 36 - 4
entry/src/main/ets/view/LocalMusic.ets

@@ -75,7 +75,7 @@ import app from '@system.app';
 import { TextNodeController } from './PipLyricTextBuilder';
 import { IndexerView } from './IndexerView';
 import { KeyCode } from '@kit.InputKit';
-
+// import { FFmpeg, FFProgressMessageParser } from '@sj/ffmpeg';
 const TAG = 'LocalMusic';
 
 const DEFAULT_INDEX =
@@ -4398,6 +4398,9 @@ export struct LocalMusic {
         LogUtil.info('this.currentSong.sampleRate =' + this.currentSong.sampleRate)
         LogUtil.info('this.currentSongmimeType =' + this.currentSong.mimeType)
         this.startPlayOrResumePlay()
+        // let outputPath = this.videoUrl.substring(0, this.videoUrl.lastIndexOf('.')) + '.json'
+        // this.readCoverInfo(this.videoUrl,outputPath)
+        // this.readMediaInfo(this.videoUrl)
         break;
 
     }
@@ -4405,6 +4408,32 @@ export struct LocalMusic {
 
   }
 
+  // readCoverInfo(inputPath:string,outputPath:string){
+  //   let commands = ["ffmpeg", "-i", inputPath, "-f ffmetadata",outputPath];
+  //   FFmpeg.execute(commands, {
+  //     logCallback: (logLevel: number, logMessage: string) => console.log(`[${logLevel}]${logMessage}`),
+  //     progressCallback: (message: string) => console.log(`[onecold FFmpeg progress]${JSON.stringify(FFProgressMessageParser.parse(message))}`),
+  //   }).then(() => {
+  //     console.info("onecold FFmpeg execution succeeded.");
+  //   }).catch((error: Error) => {
+  //     console.error(`onecold FFmpeg execution failed with error: ${error.message}`);
+  //   });
+  // }
+
+
+  // readMediaInfo(inputPath:string){
+  //   let commands = ["ffprobe", "-v", "info", "-of", "json", "-show_entries", "stream=sample_rate,bit_rate", "-i", inputPath];
+  //   let outputJson = "";
+  //   FFmpeg.execute(commands, {
+  //     logCallback: (logLevel: number, logMessage: string) => console.log(`[${logLevel}]${logMessage}`),
+  //     outputCallback: (message: string) => { outputJson += message; },
+  //   }).then(() => {
+  //     console.info(`Execution succeeded with output: ${outputJson}`);
+  //   }).catch((error: Error) => {
+  //     console.error(`Execution failed with error: ${error.message}`);
+  //   });
+  // }
+
   @Builder
   PlayController() {
     Column() {
@@ -7018,6 +7047,8 @@ export struct LocalMusic {
     })
   }
 
+
+
   isBigScreen() {
     if (this.currentWidthBreakpoint == WidthBreakpoint.WIDTH_LG) {
       return true
@@ -8243,9 +8274,10 @@ export struct LocalMusic {
           .onClick(() => {
             DialogHelper.closeDialog('tips'); //关闭弹框
             this.isShowPlay = false
-            router.pushUrl({
-              url: 'pages/SettingPage'
-            }, router.RouterMode.Single);
+            this.mType = 3
+            // router.pushUrl({
+            //   url: 'pages/SettingPage'
+            // }, router.RouterMode.Single);
           })
       }