File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,13 @@ PlaySingleSegment(seg) ==
156156 /\ currentSegment ' = seg
157157 /\ loopEnabled ' = TRUE
158158
159+ \* アンマウント (ページ遷移時のクリーンアップ)
160+ \* どの状態からでも発生し、再生を強制停止する
161+ Unmount ==
162+ /\ playState ' = "stopped"
163+ /\ currentSegment ' = 0
164+ /\ UNCHANGED << loopEnabled , selectedSegments >>
165+
159166-----------------------------------------------------------------------------
160167(* 状態遷移 *)
161168Next ==
@@ -167,6 +174,7 @@ Next ==
167174 \/ SelectAll
168175 \/ SelectNone
169176 \/ \E seg \in Segments : PlaySingleSegment ( seg )
177+ \/ Unmount
170178
171179-----------------------------------------------------------------------------
172180(* 時間的性質 *)
Original file line number Diff line number Diff line change @@ -122,6 +122,13 @@ export function AudioPlayer({
122122 onErrorRef . current = null ;
123123 } , [ ] ) ;
124124
125+ // Stop audio on unmount (e.g. page navigation)
126+ useEffect ( ( ) => {
127+ return ( ) => {
128+ cleanupAudio ( ) ;
129+ } ;
130+ } , [ cleanupAudio ] ) ;
131+
125132 // Play a specific segment
126133 const playSegment = useCallback (
127134 ( segmentIndex : number ) => {
You can’t perform that action at this time.
0 commit comments