Start a new topic

onFinishedPlaying seems not fired

onFinishedPlaying seems not fired


The onFinishedPlaying seems not fired. The following is my code. The alert("finished") not run.
Besides, the video keeps rooping.


var effect4_3 = new AR.VideoDrawable("http://www.xxxxxxxx.com/demo.mp4", 1, {
offsetX: 0,
offsetY: 0,
zOrder: 2,
onLoaded: function effect4_3Loaded() {
//playButton1.enabled = true;
effect4_3.enabled = true;
},
onPlaybackStarted: function effect4_3Playing() {
//playButton1.enabled = false;
effect4_3.enabled = true;
},
onFinishedPlaying: function effect4_3Finished() {
//playButton1.enabled = true;
alert('finished');
effect4_3.playing = false;
videoeffect4_3.enabled = false;
},
onClick: function videoeffect4_3Clicked() {
if (effect4_3.playing) {
effect4_3.pause();
effect4_3.playing = false;
} else {
effect4_3.resume();
effect4_3.playing = true;
}
}
});

 

I found that, if the VideoDrawable is created in the onEnterFieldOfVision, then the onFinishedPlaying will not be fired, but there are no problem on others such as onLoaded & onPlaybackStarted.

Moreover, the video will keep looping.

When the VideoDrawable  is created before the Trackable2DObject and using drawables: {cam: }, the onFinishedPlaying will be fired.

Is there a bug?

Can you provide a complete example so we can verify and reproduce it easily on our side? What devices are you testing this on (incl. model name, os version)? Have you tried it on multiple devices?

Thanks!

You may take a look on the demo JS.
http://www.abigbug.com/artech/demo/video/js/video.js

and load the testing world from here.
http://www.abigbug.com/artech/demo/video/index.html

That testing world is modified from your video sample 2.

I have tested on Android and iPhone.

Thanks.

It looks to me as if you are starting the video with play(-1). -1 is the loop count and in this case means loop the video infinitely. As the video will never finish playing the trigger won't be called.

Exchange play(-1) with play(1) or just play() to play it only once. This should fire the onFinishedPlaying trigger.

Thanks. It works.
Login or Signup to post a comment