Ruby on Rails Thursday, May 29, 2014

I have a variable created by some ruby in my controller that looks like
this:

@begpoint = row["begpoint"]


and I want to pass it into some js that is referenced from within my
view:

view:

<% javascript_include_tag "play_time" %>



js (play_time):

I am trying to pass "<beg-point> into the js [obviously that <> is not
the right syntax just trying to denote where'd id like the variable to
end up]


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


Can anyone help? Thanks

}, false);

}, false);

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

No comments:

Post a Comment