diff --git a/main.ts b/main.ts index b4b2a11..eb84dfb 100644 --- a/main.ts +++ b/main.ts @@ -122,18 +122,36 @@ export default class TimestampPlugin extends Plugin { //Command that play/pauses the video this.addCommand({ - id: 'pause-player', - name: 'Pause player', - editorCallback: (editor: Editor, view: MarkdownView) => { + id: 'toggle-play-pause-video', + name: 'Toggle play/pause video', + callback: () => { this.setPlaying(!this.player.props.playing) } }); + //Command that plays the video + this.addCommand({ + id: 'play-video', + name: 'Play video', + callback: () => { + this.setPlaying(true) + } + }); + + //Command that pauses the video + this.addCommand({ + id: 'pause-video', + name: 'Pause video', + callback: () => { + this.setPlaying(false) + } + }); + // Seek forward by set amount of seconds this.addCommand({ id: 'seek-forward', - name: 'Seek Forward', - editorCallback: (editor: Editor, view: MarkdownView) => { + name: 'Seek forward', + callback: () => { if (this.player) this.player.seekTo(this.player.getCurrentTime() + parseInt(this.settings.forwardSeek)); } }); @@ -141,8 +159,8 @@ export default class TimestampPlugin extends Plugin { // Seek backwards by set amount of seconds this.addCommand({ id: 'seek-backward', - name: 'Seek Backward', - editorCallback: (editor: Editor, view: MarkdownView) => { + name: 'Seek backward', + callback: () => { if (this.player) this.player.seekTo(this.player.getCurrentTime() - parseInt(this.settings.backwardsSeek)); } });