|
|
@@ -91,7 +91,8 @@ public class SwiftDubbingLibPlugin: NSObject, FlutterPlugin {
|
|
|
|
|
|
func initAudioSession(){
|
|
|
do {
|
|
|
- if (!initFlag) {
|
|
|
+// if (!initFlag) {
|
|
|
+ if (true) {
|
|
|
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, options: .defaultToSpeaker)
|
|
|
try AVAudioSession.sharedInstance().setActive(true)
|
|
|
initFlag = true
|
|
|
@@ -145,6 +146,7 @@ extension SwiftDubbingLibPlugin {
|
|
|
//AVLinearPCMIsFloatKey : true, //是否使用浮点数采样
|
|
|
]
|
|
|
let url = URL(fileURLWithPath: filePath)
|
|
|
+
|
|
|
audioRecorder = try AVAudioRecorder(url: url, settings: settings)
|
|
|
audioRecorder?.prepareToRecord()
|
|
|
audioRecorder?.record()
|