2

からのリクエストがブラウザかどうかを確認してから、ビデオ 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     });

これは可能ですか、それとも他の代替ソリューションですか?

よろしく

4

1 に答える 1