Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,45 @@ 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));
}
});

// 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));
}
});
Expand Down