Bottons from Video

Hi.
Is there a way to create PLAY, STOP and RESTART buttons for a video that is on the slide? I would not want to use the video player buttons

ActivePresenter
Windows 7

Hi,

You can use the following scripts to play, stop and restart a video:

Play:

prez.object('video name').animate(AP.EffectType.MEDIA_PLAY);

Stop:

prez.object('video name').animate(AP.EffectType.MEDIA_STOP);

Restart: seek the video to the end, wait a moment, then play it again. If it doesn’t work sometime, please increase the wait time.

var videoObject = prez.object('video name');
var wait = 500; //ms
videoObject.animate(AP.EffectType.MEDIA_PLAY);
videoObject.animate(AP.EffectType.MEDIA_SEEK);
setTimeout(function() {
    videoObject.animate(AP.EffectType.MEDIA_PLAY);
}, wait);

We’ll consider supporting media playback actions in the future.

Regards

2 Likes

Hello, thanks. Worked perfectly.
I would like that when the video is over, a button appears, how do I do?

Unfortunately, it’s not possible with video started by script in the current version.
We’ll try to improve it in future releases.

Regards

In version 8.0.1, is it now possible to make a button appear when the video is finished?

And how do I make the button maximize and minimize the video?

Hi,

It’s still not avaialble in the latest version (8.0.3) yet.
But you can use an interactive timeline insteading of scripting to do that.
In the interactive timeline, insert an appear effect for the video at 0, and an appear effect for the button at the end of the video (you must know the video duration).
Please also remember to set the video to be autoplay and initially hidden, the button to be initially hidden.
After that, you can use Continue/Pause Timeline action to play/pause the video, Start Timeline action to start the video.

For fullscreen, you can use the script below:

var fsAPI = AP.fullscreen;
if (fsAPI.fullscreenElement())
  fsAPI.exitFullscreen();
else
  fsAPI.requestFullscreen(prez.object('your video object name').node);

Regards

Hi,

how would I play ‘Mouse Click 1’ through Javascript together with ‘blocking’? Is that possible? I tried ‘Mouse Click 1’ as video name, but it wouldn’t work.

Thanks,
Rolf

Hi Rolf,

Please make sure that the video name is unique within the slide.
You can also try adding AP.logDebug.disabled = false; at the beginning of your script, and press F12 when previewing in the browser to see if there’s any error in the browser Console.

Regards

Hi,

I was thinking about audios, not videos.
I tried

prez.object('audio name').animate(AP.EffectType.MEDIA_PLAY);

but that didn’t work.

Is there a way to play an audio from JS other than starting a timeline?

Thanks,

Rolf

@Rolf - looks like your code is fine.
Did you remember to place an instance of the audio on the stage?

image

The icon will not show when you preview but it should allow the file to be found when you trigger the code.

Thanks, Greg,

I don’t know what happened. I think I’ve done it and I’ve named everything uniquely … and now it works.

Must have somehow corrected a mistake (maybe a typo or so, but I thought I had checked everything) I was not aware of. No idea …

Anyway, thanks again, Rolf

Got it now: If I uncheck autoplay it works!

1 Like