Time Seek JavaScript not working in Chrome
December 31, 2014 12:00 AM
Hi everyone,
Not sure how many programmers we have on here but I am a bit stumpped on an issue here.
I have JavaScript in my course that lets me jump to a position in a video in seconds. So, I have one large video and if you click on one topic the video jumps to 1 minute 30 seconds in. A different click brings you to 5 minutes in, etc.
I do this with a simple action:
On click, Run JavaScript,
document.getElementById('swfvideo904').sendEvent('SEEK', 530);
This is for an MP4 video. swfvideo904 comes from publishing the course once to HTML and opening the HTML file. From there you can find out the object name that Lectora gives it. In this example it is that, but it changes page to page.
So my issue is, this work fine in HTML but doesn't do anything at all in Chrome.
Was wondering if anyone else does this and has any ideas.
Thanks
Discussion (4)
I'm sorry, I don't know why I typed HTML... I think I had getting out of the office for the holidays on my mind.
Yes. The code I listed works fine on all versions of IE but not in Chrome.
It doesn't throw any errors, it just doesn't do anything at all. You click on the button and nothing happens.
I can share this, via private message or something... I attached a screen shot of the code for now.
I'm on Lectora 12 at the moment, but this issue is the same in Lectora 11.
This has been up on an LMS and doesnt' work on Chrome there either. Works on IE both local and via LMS but doesn't work on Chrome either way.
1. You don't have to look into published HTML to see the HTML name. It's visible in Lectora, too (see this - http://lectora.com/forum/showthread.php?t=12985)
2. I'd be happy to help but I don't understand the problem. What do you mean by "this work fine in HTML but doesn't do anything at all in Chrome"? Chrome IS html, isn't it?
So, help me out:
- what Lectora version?
- do you have a sample to share?
- does it work in IE?
- have you tried putting it online (on a server / LMS) and viewing it in Chrome from there?
- hit F12 and look in the error console in Chrome. Does it report any errors?
I've built a sample here: https://dl.dropboxusercontent.com/u/11433463/trivantis/htmlvid/index.html
It does work in Chrome. The code on the button is video38.flsPlayer.sendEvent('SEEK', 21) - note that I let Lectora do the "getElement" part behind the scenes. If you look into the flsPlayer object and its sendEvent method, you'll see it has some browser specific code so I don't want to mess with that.
And "video38" is obviously the html name of my video object in Lectora.
It works fine except it doesn't seek to parts that aren't loaded yet. I think it's either the file format limitation, or server setup limitation, or JWplayer limitation. Here's some info - http://support.jwplayer.com/customer/portal/articles/1430518-pseudo-streaming-in-flash - I haven't looked in-depth yet.
Thank you! This works perfectly in both Chrome and IE.
Yes, I have noticed that you can't jump to a spot until after the video loads. I think the jump to has only worked for me when the video was loaded via streaming server with MMS or RTSP. When the video is embedded, you can only jump up to a point that is loaded.
Thanks again.
Discussions have been disabled for this post