Skip to content

Commit 1c93dbf

Browse files
Add interruptions to JS SDK (#204)
## Description Describe your changes. ## Motivation and Context Why is this change required? What problem does it solve? If it fixes an open issue, please link to the issue here. ## Documentation impact - [ ] Documentation update required - [ ] Documentation updated [in another PR](_) - [ ] No documentation update required ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1 parent ad5e5df commit 1c93dbf

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

packages/js-server-sdk/src/agent.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ export class FishjamAgent extends (EventEmitter as new () => TypedEmitter<AgentE
7676
return track;
7777
}
7878

79+
/**
80+
* Interrupt track indentified by `trackId`.
81+
*
82+
* Any audio that has been sent by the agent, but not played
83+
* by Fishjam will be cleared and be prevented from playing.
84+
*
85+
* Audio sent after the interrupt will be played normally.
86+
*/
87+
public interruptTrack(trackId: TrackId): void {
88+
const msg = AgentRequest.encode({ interruptTrack: { trackId: trackId } }).finish();
89+
90+
this.client.send(msg);
91+
}
92+
7993
/**
8094
* Deletes an outgoing audio track for the agent
8195
*/

0 commit comments

Comments
 (0)