File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useSettingStore } from "@/stores" ;
12import { TypedEventTarget } from "@/utils/TypedEventTarget" ;
23import type { IExtendedAudioContext } from "@/types/audio/context" ;
34import { AudioEffectManager } from "./AudioEffectManager" ;
@@ -108,7 +109,8 @@ export abstract class BaseAudioPlayer
108109 processedNode . connect ( this . gainNode ) ;
109110 this . gainNode . connect ( getSharedMasterInput ( ) ) ;
110111
111- if ( this . audioCtx . latencyHint === "playback" ) {
112+ const settingStore = useSettingStore ( ) ;
113+ if ( settingStore . audioLatencyHint === "playback" ) {
112114 this . compensatedLatency =
113115 ( this . audioCtx . outputLatency || 0 ) + ( this . audioCtx . baseLatency || 0 ) ;
114116 } else {
Original file line number Diff line number Diff line change @@ -268,6 +268,11 @@ export class MpvPlayer extends EventTarget implements IPlaybackEngine {
268268 }
269269 }
270270
271+ public setAudioDelayCompensation ( offset : number ) : void {
272+ // MPV 引擎不使用 Web Audio API,此设置无效
273+ void offset ;
274+ }
275+
271276 public getErrorCode ( ) : number {
272277 return this . _errorCode ;
273278 }
Original file line number Diff line number Diff line change @@ -371,6 +371,11 @@ export class FFmpegAudioPlayer extends BaseAudioPlayer {
371371 return this . currentTempo ;
372372 }
373373
374+ public setAudioDelayCompensation ( offset : number ) : void {
375+ // FFmpeg 引擎使用独立的时钟同步机制,此设置无效
376+ void offset ;
377+ }
378+
374379 public async setTempo ( tempo : number ) {
375380 if ( ! this . worker ) return ;
376381 const trueTime = this . currentTime ;
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ export const getSharedAudioContext = (): IExtendedAudioContext => {
2525 sharedContext = new AudioContextClass ( {
2626 latencyHint : settingStore . audioLatencyHint ,
2727 } ) as IExtendedAudioContext ;
28- sharedContext . latencyHint = settingStore . audioLatencyHint ;
2928 }
3029 return sharedContext ;
3130} ;
You can’t perform that action at this time.
0 commit comments