我想检查来自浏览器的请求,然后将视频 cdn 链接公开给 jwplayer。我想从下载中制作硬视频。
我的路线代码是
4 match "/assets/protect/:id.:format" => "streams#show"
我的控制器代码是
1 class StreamsController < ApplicationController
2 def show
3 self.response.headers["Location"] = Video.find(params[:id]).video.url.safe # here is the condition if request is from browser
4 render nothing: true, layout: false
5 end
6 end
我的 JS 代码
2 jwplayer("video-player-container").setup({
3 file: "/assets/protect/<%= @video.id %>.flv",
4 wmode: 'transparent',
5 flashplayer: "/jwplayer/player.swf",
6 players: [{ type: "flash", src: "/jwplayer/player.swf" }, { type: "html5" }]
7 });
这是可能的还是任何其他替代解决方案?
问候
五