Abe Petrillo Abe Petrillo - 1 year ago 59
Javascript Question

Uploaded event on ZiggeoApi not being fired

After looking at the ZiggeoApi docs I attempted to use the


ZiggeoApi.Events.on "system_ready", ->
recorder = ZiggeoApi.V2.Recorder.findByElement($('#ziggeo-recorder-embedding')[0])
recorder.on "verified", (params...) ->
console.log('uploaded', params...)
recorder.on "uploaded", (params...) ->
console.log('uploaded', params...)

In the above code,
does fire, but
does not. I'm using V2 of the API which is in beta, so I'm wondering whether this is a bug.

All I need is the video id once the video is uploaded so I have a reference to it for later retrieval. The documentation for what
is for each event is somewhat lacking, and for
you don't actually get anything passed in as an argument when the event is fired. Any work arounds are most welcome!

Answer Source

v2 does not require the data parameter to pass the token as you can grab it at any point directly.

To do that you would use the code such as this:


Also it is good to mention that as soon as the upload is started the token is already available in both v1 and v2 so you should be able to grab them even then if needed.

The JavaScript SDK documentation pages is relatively new, and the Events page shows wrong code sample for v2 at the moment.

Correct way to add it would be:

recorder.on("uploaded", function() {

Adding a working sample showing both verified, uploading and uploaded events

ZiggeoApi.token = "a48e03aee097e23697b165ad6060f32f";

ZiggeoApi.Events.on("system_ready", function() {
  var element = document.getElementById('ziggeo-recorder-embedding');
  var recorder = ZiggeoApi.V2.Recorder.findByElement( element );
  recorder.on('verified', function() {
    console.log("video was verified. It's token is:" + recorder.get('video') );
  recorder.on('uploading', function() {
    console.log("video is uploading. It's token is:" + recorder.get('video') );
  //Requires v1-r18 or higher to work
  recorder.on('uploaded', function() {
    console.log("video is uploaded. It's token is:" + recorder.get('video') );
    <link rel="stylesheet" href="https://assets-cdn.ziggeo.com/v1-r18/ziggeo.css" />
    <script src="https://assets-cdn.ziggeo.com/v1-r18/ziggeo.js"></script>


  • The snippet might not work (depending on browser and its security settings) however using the same code on localhost or some server will.

  • Good to mention also that uploaded event does in deed not seem to work at this point - so it is a bug.

If it is in the documentation it is considered as something that should work (and was working), so if it is not, it is definitely some kind of a bug.

To summarize, you did find a bug with uploaded event, however for what you are after you could use uploading event instead as so:

recorder.on("uploading", function() {

EDIT 2016/10/28

The uploaded event was actually introduced in r18, so it should work in r18, 19 and up.

It will however not work on stable tag since it points currently to v1-r16 during which it was not available.

  • I have updated the sample script above and the code on the docs page will be fixed soon as well.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download