views:

170

answers:

1

I am using flow player in my site to view the videos , Now on the index view i have all the videos . but to show that video i have made remote_link to open it on the same page

I got the video on the page too , but it is not displaying , i can even save the video by clicking it , but i cant see the player at all my code is

controller

@video = Upload.find_by_id(params[:id])
render :update do |page|
  page[:"div_video_#{@video.id}"].innerHTML = render :partial => "display_video"
  page[:"div_video_#{@video.id}"].show
end

Waht i want is to dispaly the video by ajax call from controller , please help me?

+1  A: 

The problem is that the flowplayer function has already been initialized on the page, and so won't affect any new html you put into it, you'll need to recall the flowplayer function after the page has been updated, something like this:

@video = Upload.find_by_id(params[:id])
render :update do |page|
  page[:"div_video_#{@video.id}"].innerHTML = render :partial => "display_video"
  page.flowplayer("player", "path/to/the/flowplayer-3.1.5.swf")
  page[:"div_video_#{@video.id}"].show
end
Andrew Nesbitt
thanks for the positive reply , there is one more way to solve this problem . when i call the flow player we can change the ID of the player that is in scriptflowplayer("player_<%= video.id %>", "/flowplayer/flowplayer-3.1.2.swf",{clip:{autoPlay: false,autoBuffering: false}});and in view side in the link id="player_<%= video.id %>"then we can work ,, Thanks , andrew
Arpit Vaishnav