Skip to content

Commit

Permalink
Add companion button to end videos early
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Feb 24, 2024
1 parent 015bb90 commit b65ab1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions companion-plugin/companion-module-esa/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ function initActions(instance: ModuleInstance, videos?: { name: string, sum: str
}
},
},
video_stop: {
name: 'Video Stop',
description: 'Stops any videos playing, to be used in emergencies',
options: [],
callback: () => {
instance.wsSend({ name: 'video_stop' });
},
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/extension/companion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { startPlaylist } from './intermission-player';
import { player, startPlaylist } from './intermission-player';
import companion from './util/companion';
import { wait } from './util/helpers';
import { get as nodecg } from './util/nodecg';
Expand Down Expand Up @@ -141,5 +141,7 @@ companion.evt.on('action', async (name, value) => {
await startPlaylist();
}
}
} else if (name === 'video_stop') {
await player.endPlaylistEarly();
}
});
2 changes: 1 addition & 1 deletion src/extension/intermission-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { assetsVideos, obsData, videoPlayer } from './util/replicants';
import { sc } from './util/speedcontrol';

const config = nodecg().bundleConfig;
const player = new Player(nodecg(), config.obs, obs);
export const player = new Player(nodecg(), config.obs, obs);

// Reset replicant values on startup.
videoPlayer.value.playing = false;
Expand Down

0 comments on commit b65ab1a

Please sign in to comment.