Mohamed Emad Hegab
Mohamed Emad Hegab

Reputation: 2675

Rails: render video from url

I have the following problem

i'm trying to do this

def webm
  @url = Video.find(params[:id]).avatar.url(:webm_sd)
  render json: @url
end

but that can not be used in something like this

<source src='http://localhost:3000/api/v1/webm?id="+videoId+"' type='video/webm'>

cause the type it waits is video not string .. i need a way to render video instead of json

Upvotes: 0

Views: 545

Answers (1)

Dominik Goltermann
Dominik Goltermann

Reputation: 4306

do you want to link to a video file using a get parameter? e.g. url?video_id=x? Then simply redirect to the correct video file in your controller using redirect_to That should work.

Upvotes: 2

Related Questions