添加iOS权限

This commit is contained in:
魏少阳 2023-12-21 17:52:40 +08:00
parent 535d274c6e
commit 05eb47f1d1
2 changed files with 9 additions and 6 deletions

View File

@ -46,7 +46,7 @@
<key>NSLocationWhenInUseUsageDescription</key> <key>NSLocationWhenInUseUsageDescription</key>
<string>应用在前台的时候可以搜到更新的位置信息</string> <string>应用在前台的时候可以搜到更新的位置信息</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>用于音频插件</string> <string>应用请求麦克风用来通话</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>用于相册</string> <string>用于相册</string>
<key>UIApplicationSceneManifest</key> <key>UIApplicationSceneManifest</key>

View File

@ -196,12 +196,12 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
longPressUp: () async { longPressUp: () async {
// //
print("onLongPressUp"); print("onLongPressUp");
// _playRecording();
if (state.udpStatus.value == 9) { if (state.udpStatus.value == 9) {
state.udpStatus.value = 8; state.udpStatus.value = 8;
} }
_stopRecording(); _stopRecording();
_playRecording();
} }
) )
), ),
@ -223,7 +223,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
}), }),
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
"开锁", AppColors.mainColor, () { "开锁", AppColors.mainColor, () {
showDeletPasswordAlertDialog(context); showDeletPasswordAlertDialog(context);
}) })
]); ]);
} }
@ -353,6 +353,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
getFilePath().then((value) { getFilePath().then((value) {
filePath = value; filePath = value;
}); });
await recorder.openRecorder();
await recorder.startRecorder( await recorder.startRecorder(
toFile: filePath, toFile: filePath,
codec: Codec.pcm16WAV, codec: Codec.pcm16WAV,
@ -390,7 +391,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
Future<String> getFilePath() async { Future<String> getFilePath() async {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
final filePath = '${directory.path}/recording.wav'; final filePath = '${directory.path}/recording.mp3';
// //
File file = File(filePath); File file = File(filePath);
@ -411,11 +412,13 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
// //
_playRecording() async { _playRecording() async {
player = FlutterSoundPlayer(); player = FlutterSoundPlayer();
player.openPlayer();
await player.startPlayer( await player.startPlayer(
fromURI: filePath, fromURI: filePath,
codec: Codec.pcm16WAV, codec: Codec.pcm16WAV,
); );
Toast.show(msg: "储存录音播放了"); // Toast.show(msg: "储存录音播放了");
print('_playRecording() 储存录音播放了'); print('_playRecording() 储存录音播放了');
} }