Browse Source

Merge branch 'new_dev' of github.com:deepcloud2048/deep_voice into new_dev

newdev_shunjiawei
lxm 9 months ago
parent
commit
ce24c1a6cc
  1. 7
      lib/modules/music/views/music_playlist_view.dart
  2. 2
      local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
  3. 4
      local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift
  4. 2
      local_plugins/chat_api/ios/chat_api/Sources/chat_api/MCPClient.swift
  5. 14
      local_plugins/music_service/ios/music_service/Sources/music_service/MusicService.swift

7
lib/modules/music/views/music_playlist_view.dart

@ -546,6 +546,13 @@ class MusicPlaylistView extends StatelessWidget {
child: Slider( child: Slider(
value: controller.progress.value.clamp(0.0, 1.0), value: controller.progress.value.clamp(0.0, 1.0),
onChanged: (value) { onChanged: (value) {
// 拖动中仅更新UI显示,不触发实际跳转
controller.progress.value = value;
controller.currentPosition.value =
(controller.duration.value * value).round();
},
onChangeEnd: (value) {
// 松开时再执行跳转,确保拖动自然
final targetPosition = final targetPosition =
(controller.duration.value * value).round(); (controller.duration.value * value).round();
controller.seekToPosition(targetPosition); controller.seekToPosition(targetPosition);

2
local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt

@ -446,7 +446,7 @@ object AgentService : CoroutineScope {
setPackage(context.packageName) setPackage(context.packageName)
} }
context.sendBroadcast(intent) context.sendBroadcast(intent)
Log.e(TAG, "QQ 音乐暂停播放") // Log.e(TAG, "QQ 音乐暂停播放")
autopauseMusic() autopauseMusic()
// QQMusicSingleton.getInstance().autopauseMusic { result -> // QQMusicSingleton.getInstance().autopauseMusic { result ->
// if (result.isSuccess) { // if (result.isSuccess) {

4
local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift

@ -190,8 +190,8 @@ class AgentServiceImpl: NSObject {
self.config = config self.config = config
if let navigationMode = config["navigationMode"] as? String { if let navigationMode = config["navigationMode"] as? String {
self.navigationMode = navigationMode self.navigationMode = navigationMode
} }
if let callingToolText = config["callingToolText"] as? String { if let callingToolText = config["callingToolText"] as? String {
self.callingToolText = callingToolText self.callingToolText = callingToolText

2
local_plugins/chat_api/ios/chat_api/Sources/chat_api/MCPClient.swift

@ -431,7 +431,7 @@ public class MCPClient {
public init(musicServiceType: String) { public init(musicServiceType: String) {
initializeSystemFunctions() initializeSystemFunctions()
print("musicServiceType: \(musicServiceType)")
switch musicServiceType { switch musicServiceType {
case "WY": case "WY":
initializeMusicSystemFunction() // 更明确的命名 initializeMusicSystemFunction() // 更明确的命名

14
local_plugins/music_service/ios/music_service/Sources/music_service/MusicService.swift

@ -565,7 +565,14 @@ public class MusicService: NSObject {
// 记录当前播放状态 // 记录当前播放状态
let wasPlaying = isPlaying let wasPlaying = isPlaying
let time = CMTime(seconds: Double(positionMs) / 1000.0, preferredTimescale: CMTimeScale(NSEC_PER_SEC)) // 幂等短路:相同位置重复seek直接忽略
let currentSeconds = CMTimeGetSeconds(player.currentTime())
if !currentSeconds.isNaN && !currentSeconds.isInfinite {
let currentMs = Int(currentSeconds * 1000)
if currentMs == positionMs { return }
}
let time: CMTime = CMTime(seconds: Double(positionMs) / 1000.0, preferredTimescale: CMTimeScale(NSEC_PER_SEC))
player.seek(to: time) { [weak self] completed in player.seek(to: time) { [weak self] completed in
if completed { if completed {
@ -575,15 +582,10 @@ public class MusicService: NSObject {
if wasPlaying { if wasPlaying {
self?.player?.play() self?.player?.play()
self?.isPlaying = true self?.isPlaying = true
self?.updateMediaSessionPlaybackState(isPlaying: true)
self?.startProgressTimer()
} }
// 立即更新进度信息到系统媒体控制中心 // 立即更新进度信息到系统媒体控制中心
self?.updateProgressInfoImmediately() self?.updateProgressInfoImmediately()
// 通知Flutter层
self?.flutterChannel?.invokeMethod("onMediaSessionSeekTo", arguments: ["position": positionMs])
} }
} }
} }

Loading…
Cancel
Save