Post

2 followers Follow
0
Avatar

'attached' and 'loaded' events not triggering(?)

This question is related to my previous one. 

 

I tried to play recorded video in the recorder as soon as it has finished loading, but 'attached' and 'loaded' events don't seem to be triggering at all (even if the only code in there are some test alerts, nothing happens). 

 

I tried both embedding and application events:

_ziggeoApp.embed_events.on("attached", function () {
        alert('attached');
});

_recorder.on('attached', function () {
        alert('attached');
        //_recorder.play();
});

 

UPD: Looks like 'attached' triggers when we press "Record", and then when the recording is verified. 'loaded' still never happens :) 

 

(I think there's a typo in the application events doc - the property name is application.embed_events, not embed_event - at least this is what the debugger shows :))

DarthVeyda

Please sign in to leave a comment.

3 comments

1
Avatar

Hi,

Yes, you are right it is events. Will fix that. In the regards of the attached and loaded events, I think that there is a bit of confusion in the name of them so let me give you more details.

Attached event will fire each time the embedding is attached to the page (to the DOM).

This means that if you are using player you should see it only once and if you are using recording (without rerecording option) you would see it 2 times. Once for recorder code being attached to DOM and the second one for the player code being attached to the DOM (in recorder's place).

Now the loaded event is similar, however a bit different. It is like Document loaded event just for embedding itself. It means all of its aspects have been loaded and the embedding itself is fully available. As such it will fire only once and it will ignore the fact that the module within it was removed and another attached. Again working just like Document loaded event would, as it fires only once page is completely loaded, even if most of it got changed to something else right after.

So it seems to me that it is all firing as it should, and that the issue here would be the missing s. Also each of these events should have a reference to the embedding as its first attribute / parameter in case that helps.

like application.embed_events.on('playing', function(embedding, ...) {});

Regards,
Bane

Bane 1 vote