Players
As MotorCortex provides all the necessary native commands for the execution of a Clip, any developer can develop their own Player plugin. Player plugins differ from motorcortex plugins. Their purpose is not to provide new Effects, Animations or Clips, but rather to handle the execution and presentation experience. For example a player plugin could present a motorocorotex clip as a slide presentation.
The MotorCortex Player plugin provides a video-like player experience. This experience simulates the one users have when interacting with video context. The total duration of the motorcortex clip is presented with a timeline while the current temporal position is displayed onto that timeline. The player automaticaly scales your motorcortex clip based on your clip dimensions and on the available space, making sure that the your clip is presented the best way posible in any viewport. The user can:
- execute through buttons the play and pause methods
- seek the timeline for a specific part of the clip
- manipulate the volume and the speed of execution
- loop any part of the clip
- watch the clip in fullscreen
There is also the ability to enable or disable interactivity with the clip's content. For example a clip can present a "Call to Action" button that redirects the user to another website through "mouse click" interaction. This is only posible if the clip has "pointer events" enabled. Otherwise any click interaction in the clip will trigger play or pause.
This player provides many other features available for developers such as dynamic change of motorcortex initial parameters, predifined and custom themes and many more.
Transport toggle
Pass transportOwner when another controller owns playback. Its toggle handler runs whenever the user presses a play or pause control, and its isPlaying handler reports the current playback state. Without an owner, the player calls clip.play() and clip.pause() itself.
const player = new Player({
clip,
transportOwner: {
isPlaying() {
return controller.isPlaying;
},
toggle() {
if (controller.isPlaying) controller.pause();
else controller.resume();
},
},
});
player.setTransportToggleOwner({
isPlaying: () => nextController.isPlaying,
toggle: nextController.toggle,
});
player.setTransportToggleOwner(null);
Passing null restores the default clip controls.
Seek callbacks
MCPlayerOptions supports two optional callbacks for user-initiated seeks:
const player = new Player({
clip,
onSeekStart: () => console.log("seek started"),
onSeek: (fromMs, toMs, source) => console.log({ fromMs, toMs, source }),
});
onSeekStart() receives no arguments and runs once when a seek actually starts. onSeek(fromMs, toMs, source) runs once when it completes. source is either "keyboard" or "progress_bar".
For keyboard seeks, the order is onSeekStart, playhead movement by up to 5 seconds toward the pressed arrow, clamped to the clip boundaries, then onSeek. For progress-bar seeks, onSeekStart runs on the first position change and onSeek runs after the drag completes. An arrow press at the relevant clip boundary is a no-op. A progress-bar interaction is a no-op only if the pointer never changes position. In either case, no movement or callback occurs. If a drag changes position and then returns to its starting position, it still completes and calls onSeek.
Example
Enable the pointer events through settings and go to 00:14 of the clip to to select text or images.