hwh97 6 éve
szülő
commit
6ef47c8b3e

+ 7 - 7
.idea/workspace.xml

@@ -3,7 +3,7 @@
   <component name="ChangeListManager">
     <list default="true" id="96a4f947-f66a-4efc-b495-ae979b3315bb" name="Default Changelist" comment="">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/lib/dubbing_lib.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/dubbing_lib.dart" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/dubbing_lib/DubbingLibPlugin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/dubbing_lib/DubbingLibPlugin.kt" afterDir="false" />
     </list>
     <ignored path="$PROJECT_DIR$/.dart_tool/" />
     <ignored path="$PROJECT_DIR$/.idea/" />
@@ -23,8 +23,8 @@
       <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/lib/dubbing_lib.dart">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="195">
-              <caret line="60" column="88" lean-forward="true" selection-start-line="60" selection-start-column="88" selection-end-line="60" selection-end-column="88" />
+            <state relative-caret-position="135">
+              <caret line="56" column="3" lean-forward="true" selection-start-line="56" selection-start-column="3" selection-end-line="56" selection-end-column="3" />
             </state>
           </provider>
         </entry>
@@ -164,7 +164,7 @@
     <frame x="-7" y="-7" width="1550" height="838" extended-state="6" />
     <editor active="true" />
     <layout>
-      <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
+      <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25" />
       <window_info id="Captures" order="1" side_tool="true" />
       <window_info id="Structure" order="2" side_tool="true" />
       <window_info id="Image Layers" order="3" />
@@ -179,7 +179,7 @@
       <window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
       <window_info anchor="bottom" id="Logcat" order="4" />
       <window_info anchor="bottom" id="Debug" order="5" />
-      <window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.3286119" />
+      <window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.3286119" />
       <window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
       <window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="true" />
       <window_info anchor="bottom" id="Version Control" order="9" />
@@ -246,8 +246,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/lib/dubbing_lib.dart">
       <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="195">
-          <caret line="60" column="88" lean-forward="true" selection-start-line="60" selection-start-column="88" selection-end-line="60" selection-end-column="88" />
+        <state relative-caret-position="135">
+          <caret line="56" column="3" lean-forward="true" selection-start-line="56" selection-start-column="3" selection-end-line="56" selection-end-column="3" />
         </state>
       </provider>
     </entry>

+ 11 - 11
android/src/main/kotlin/cn/i2edu/dubbing_lib/DubbingLibPlugin.kt

@@ -96,7 +96,7 @@ class DubbingLibPlugin: MethodCallHandler, MixinHandlerCallback {
   override fun onMethodCall(call: MethodCall, result: Result) {
     when (call.method) {
       "initSpeechSdk" -> {
-        SpeechUtility.createUtility(activity, SpeechConstant.APPID +"=589c15f3")
+        SpeechUtility.createUtility(activity.applicationContext, SpeechConstant.APPID +"=589c15f3")
         result.success(true)
       }
       "getPlatformVersion" -> result.success("Android ${android.os.Build.VERSION.RELEASE}")
@@ -287,8 +287,8 @@ class DubbingLibPlugin: MethodCallHandler, MixinHandlerCallback {
                   if (!TextUtils.isEmpty(builder)) {
                     val resultParser = XmlResultParser()
                     val parseResult = resultParser.parse(builder.toString()) as ReadSentenceResult
-                    Toast.makeText(activity.applicationContext,
-                            "识别成功,结果:${if (parseResult.is_rejected) "您在乱读哦" else "您没乱读结果为:${parseResult.total_score}"}", Toast.LENGTH_SHORT).show()
+//                    Toast.makeText(activity.applicationContext,
+//                            "识别成功,结果:${if (parseResult.is_rejected) "您在乱读哦" else "您没乱读结果为:${parseResult.total_score}"}", Toast.LENGTH_SHORT).show()
                     val formatWords = arrayListOf<SimpleWord>()
                     for (sentence in parseResult.sentences) {
                       val words = sentence.words
@@ -303,7 +303,7 @@ class DubbingLibPlugin: MethodCallHandler, MixinHandlerCallback {
                     channel.invokeMethod("evaluatorResult",
                             mapOf("index" to index,"score" to (if(parseResult.is_rejected) null else parseResult.total_score), "words" to JSON.toJSONString(formatWords)))
                   } else {
-                    Toast.makeText(activity.applicationContext, "识别失败,结果为空", Toast.LENGTH_SHORT).show()
+//                    Toast.makeText(activity.applicationContext, "识别失败,结果为空", Toast.LENGTH_SHORT).show()
                     channel.invokeMethod("evaluatorResult", mapOf("index" to index,"score" to null))
                   }
                 }
@@ -311,8 +311,8 @@ class DubbingLibPlugin: MethodCallHandler, MixinHandlerCallback {
 
               override fun onError(error: SpeechError) {
                 activity.runOnUiThread {
-                  Toast.makeText(activity.applicationContext, "识别失败,错误描述:${error.errorDescription},错误码:${error.errorCode}",
-                          Toast.LENGTH_SHORT).show()
+//                  Toast.makeText(activity.applicationContext, "识别失败,错误描述:${error.errorDescription},错误码:${error.errorCode}",
+//                          Toast.LENGTH_SHORT).show()
                   channel.invokeMethod("evaluatorResult", mapOf("index" to index,"score" to null))
                 }
               }
@@ -446,27 +446,27 @@ class DubbingLibPlugin: MethodCallHandler, MixinHandlerCallback {
     when (msg.what) {
       BGM_DOWNLOAD_FINISHED -> {
         // step2 解码背景音乐
-        Toast.makeText(activity.applicationContext, "BGM_DOWNLOAD_FINISHED", Toast.LENGTH_SHORT).show()
+//        Toast.makeText(activity.applicationContext, "BGM_DOWNLOAD_FINISHED", Toast.LENGTH_SHORT).show()
         val i = videoData?.bgmUrl?.lastIndexOf('/')
         val name = videoData?.bgmUrl?.substring(i!!)
         decodeBgmAudio(name!!, videoData?.bgmPath!!)
       }
       AUDIO_DECODE_FINISHED -> {
         // step3  背景音乐与录音合成
-        Toast.makeText(activity.applicationContext, "AUDIO_DECODE_FINISHED", Toast.LENGTH_SHORT).show()
+//        Toast.makeText(activity.applicationContext, "AUDIO_DECODE_FINISHED", Toast.LENGTH_SHORT).show()
         syncAudios()
       }
       AUDIO_SYN_FINISHED -> {
         // step4 编码音频
-        Toast.makeText(activity.applicationContext, "AUDIO_SYN_FINISHED", Toast.LENGTH_SHORT).show()
+//        Toast.makeText(activity.applicationContext, "AUDIO_SYN_FINISHED", Toast.LENGTH_SHORT).show()
         encodeAsynAudio()
       }
       AUDIO_ENCODE_FINISHED -> {
-        Toast.makeText(activity.applicationContext, "AUDIO_ENCODE_FINISHED", Toast.LENGTH_SHORT).show()
+//        Toast.makeText(activity.applicationContext, "AUDIO_ENCODE_FINISHED", Toast.LENGTH_SHORT).show()
         mixinAudioAndVideo()
       }
       AUDIO_MIX_VIDIO_FINISHED -> {
-        Toast.makeText(activity.applicationContext, "AUDIO_MIX_VIDIO_FINISHED", Toast.LENGTH_SHORT).show()
+//        Toast.makeText(activity.applicationContext, "AUDIO_MIX_VIDIO_FINISHED", Toast.LENGTH_SHORT).show()
         audioMixVideoFinish()
       }
     }