Highlighted

window.cpAPIInterface.navigateToTime(): error in Safari

Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Hi all,


I use the window.cpAPIInterface.navigateToTime(ms) method to let the user navigate to a certain time in a HTML5 module:

  • the time is added to the url of the module as a parameter
  • it is converted into milliseconds
  • the time in milliseconds is used in the method: when a user plays the movie, it starts at the time from the parameter.

 

This works fine in Firefox and Chrome, (no errors at all), but Safari throws an error in the console:

Unhandled Promise Rejection: AbortError: The operation was aborted.
(anonymous function)
rejectPromise

It refers to line 11106 of CPM.js but it's a bit above and beyond my skills to understand and solve this.

Questions:

  • Is this a known bug?
  • If so, is it a Captivate bug or a Safari bug?
  • If not... Does anyone have any idea what's going wrong here?

I can add my code if necessary...

Views

122

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

window.cpAPIInterface.navigateToTime(): error in Safari

Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Hi all,


I use the window.cpAPIInterface.navigateToTime(ms) method to let the user navigate to a certain time in a HTML5 module:

  • the time is added to the url of the module as a parameter
  • it is converted into milliseconds
  • the time in milliseconds is used in the method: when a user plays the movie, it starts at the time from the parameter.

 

This works fine in Firefox and Chrome, (no errors at all), but Safari throws an error in the console:

Unhandled Promise Rejection: AbortError: The operation was aborted.
(anonymous function)
rejectPromise

It refers to line 11106 of CPM.js but it's a bit above and beyond my skills to understand and solve this.

Questions:

  • Is this a known bug?
  • If so, is it a Captivate bug or a Safari bug?
  • If not... Does anyone have any idea what's going wrong here?

I can add my code if necessary...

Views

123

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 29, 2020 0
Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Since I can't edit the original message, some more information...

  • I get the error above
  • And instead of starting at the designated time, the module starts at the start of the slide that time is part of. So if I have a slide from 3:00 to 3:59 and I pass the time 3:35, the module will start at 3:00. In Chrome and Firefox it will start at 3:35, as intended. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Adobe Community Professional ,
Sep 29, 2020

Copy link to clipboard

Copied

Do they have to click the play overlay at the start or does it just try to jump to the time?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Thank's for the reply

 

To answer your question: they have to click the overlay (which doesn't bother me). Basically, I use an external script which is loaded on the first slide, and then takes the user to the desired position.

 

But I was already able to narrow the problem down:
1. The error above is unrelated

 

2. However, the problem also appears if I don't use my script:

  • Create a button in Captivate on the first slide
  • Create an advanced action on the button, and Execute the JavaScript cpAPIInterface.navigateToTime(16000)
  • Firefox will navigate to the correct position (2:40 in this case)
  • Safari will navigate to 2:40 for the visual representation, but will start playing the associated sound file for that slide from the start. The visual representation will hang until the sound file reaches the right spot (so 2:40) and will then run along nicely.
  • Safari's behaviour can be 'corrected' by going back to the first slide and hitting the button again. Then the module will go to 2:40 for both the visual representation and the sound.

It seems that Safari needs the sound file of a slide to be loaded before it can jump to a certain part of that file. Can I somehow check whether the sound file is loaded? Or any other ideas?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Advocate ,
Sep 29, 2020

Copy link to clipboard

Copied

For what it is worth...

I always make my audio play based on an event that is triggered by the learner rather than playing automatically at any given point. When it comes to slide narration, especially if it is just a word for word reading of the slide - that means providing a little speaker icon of some sort. If the learner wants to listen they can click it - otherwise if they are fine to just read what is there - they are not forced to listen.

Of course - I am not sure whether that will work with the way you have this designed but perhaps the thought may help determine a solution.

Since everything I do personally is event driven rather than time driven - I do not make use of such commands and my timelines are basically just to help me layer items and they typically just stay at my default of 1 second duration.

 

Stagprime_0-1601385837385.png

 

That being said, I hope this was helpful in some way.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Thanks for the reply, but I think that we use Captivate in a different way.

I understand what you're saying, but I provide instructions/narration that can be muted. My modules are not very interactive, they basically demonstrate how to use a certain app.

Nevertheless, it can be handy to "deep-link" to a certain time (if that is a concept one uses) in the module and Captivate seems to offer that. Except for the Safari bug 😞

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Adobe Community Professional ,
Sep 29, 2020

Copy link to clipboard

Copied

Instead of using an advanced action that initiates JavaScript, why not simply use the Assign the variable cpCmndGotoFrameAndResume with the literal value of what frame in your eLearning course you want to jump to? In Captivate there are 30 frames per second so if you wish to jump to the 1-minute mark in your course you would enter in the value 1800, for example.

Paul Wilson, CTDP | https://captivateteacher.com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Explorer ,
Sep 29, 2020

Copy link to clipboard

Copied

Hi Paul,
Thank your for your help!

I put it in an external JavaScript file because

  • it is easier to manage. If I have to change the code, I only have to change one file.
  • I also use other functions (to show a timer for elapsed vs total time).

 

I already tried your suggestion:

  • use window.cpAPIInterface.setVariableValue("cpCmndGotoFrame", frame); in external JavaScript file -> same behaviour: Firefox is ok, Safari isn't
  • Add a button to the first slide, Assign the variable cpCmndGotoFrameAndResume to a frame and click the button -> same behaviour: Firefox is ok, Safari isn't

 

I'm running out of ideas here. I used an addEventListener for cpInfoCurrentFrame and Safari's console shows nicely that the frames stop progressing (!!!). Maybe I can do something with that observation, but it looks like a dirty hack to me.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Explorer ,
Oct 02, 2020

Copy link to clipboard

Copied

This bug can't be solved, but I found a workaround which I will describe for future reference:

The problem

  • The captivate module is told to go to a certain time in the video
  • This works in FF and Chrome, but not in Safari. Why?
    • Safari goes to the correct time visually but starts playing the sound from the beginning of the slide
      • The image is "frozen": the animation doesn't move forward, but the sound does (even though it is lagging behind the animation)
    • Once the sound catches up, both the sound and the video run in sync again.
  • The problem goes away if you rewind and try again or refresh and try again.

The diagnose

  • I assume that Safari wants the sound file attached to the slide to be loaded before it can navigate to a time inside this sound file.
  • If the sound file isn't loaded, it will load it and start from the beginning

The hack

  • Tell the module to go to a certain time
  • After 1 second, check whether it has moved forward only 15/16 frames, with some margin (<20)
    • If so: this is Safari, that is 'hanging' at 15/16 frames
    • If not: this is FF or Chrome, that is behaving well
  • If it is Safari, tell the module to
    • Go back 1 slide
    • Wait 60ms
    • Go back to the intended time
  • Since the sound file is loaded now, Safari will behave

Needless to say, this isn ugly workaround. I still have to check it, but it seems to work.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 02, 2020 0