Ruby on Rails Wednesday, May 28, 2014

Walter...thanks for your responses!

Do I not already have that here:

myPlayer.addEventListener('loadeddata', function(){...


??

For the record the javascript that i have written there works great
within its own flatfile. I just can't get it to render within rails so
I know the code works...


here is my view:

<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="video-js.css" rel="stylesheet" type="text/css">

</head>
<body>

<video id="example_video_1" class="video-js vjs-default-skin" controls
preload="auto" width="640" height="264"
poster="http://video-js.zencoder.com/oceans-clip.png"
data-setup="{}">

<source src="/assets/test-meeting.m4v" type='video/mp4' />
</video>

</body>

<% javascript_include_tag "play_time" %>
</html>

and here is my play_time.js:


var endtime = 10505.89+10;
myPlayer= document.getElementById('example_video_1');
myPlayer.addEventListener('loadeddata', function(){
example_video_1.currentTime = 10505.89;
example_video_1.play();
myPlayer.addEventListener('timeupdate', function(){
if (example_video_1.currentTime >= endtime) {
example_video_1.pause();
}

}, false);

}, false);

The video does show up and I can make it play, but this js is supposed
to make it play from that specific time.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e5f7e39d0b8cb50ca6c75a3acacf4fb5%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment