Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ethan
/
appframe
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit a6bc5367
authored
2025-12-23 17:33:02 +0800
by
tanghuan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
ios播放测试
1 parent
78bc113a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletions
lib/services/player_service.dart
lib/services/player_service.dart
View file @
a6bc536
...
...
@@ -32,7 +32,19 @@ class PlayerService {
// 针对iOS, 需要控制不使用听筒进行播放
if
(
Platform
.
isIOS
)
{
var
audioSession
=
await
AudioSession
.
instance
;
await
audioSession
.
configure
(
AudioSessionConfiguration
.
music
());
await
audioSession
.
configure
(
AudioSessionConfiguration
(
avAudioSessionCategory:
AVAudioSessionCategory
.
playback
,
avAudioSessionCategoryOptions:
AVAudioSessionCategoryOptions
.
defaultToSpeaker
,
avAudioSessionMode:
AVAudioSessionMode
.
spokenAudio
,
androidAudioAttributes:
const
AndroidAudioAttributes
(
contentType:
AndroidAudioContentType
.
speech
,
usage:
AndroidAudioUsage
.
media
,
),
androidAudioFocusGainType:
AndroidAudioFocusGainType
.
gain
,
androidWillPauseWhenDucked:
true
,
),
);
}
final
player
=
FlutterSoundPlayer
();
...
...
@@ -69,6 +81,22 @@ class PlayerService {
}
}
// // 获取当前音频会话配置
// AudioSession session = await AudioSession.instance;
// if (session.isConfigured) {
// AudioSessionConfiguration config = session.configuration!;
//
// // 打印音频会话信息
// debugPrint('音频会话配置: ${config.toString()}');
// debugPrint('音频模式: ${config.avAudioSessionMode ?? "N/A"}');
// debugPrint('音频类别: ${config.avAudioSessionCategory ?? "N/A"}');
// } else {
// debugPrint('还未配置音频会话');
// }
// var currentRoute = await AVAudioSession().currentRoute;
// debugPrint('当前音频路由: ${currentRoute.outputs}');
_playId
=
playId
;
// 播放速度
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment