Ruby on Rails Friday, June 6, 2014

Believe it or not I'm still fighting with this thing in the rails
context.

This js works PERFECTLY within its own flat file outside of rails.
However when I try and incorporate it into rails the video starts right
from the beginning, I know someone must have solved this one at some
point:

<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="/assets/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>

<% javascript_include_tag "play_time" %>

</body>


</html>


Here is 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);

Any suggestions? When I use Developer Tools I get:

0: "Video Error"
1: Object
length: 2
__proto__: Array[0]

--
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/53747ca04a43efe7e3d4643748a9e27b%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment