Rails 3 Flowplayer Gem 用法
我正在尝试在我的 Rails 3 应用程序中使用 flowplayer gem 。我已按照安装说明进行操作
Rails 3 的 Flowplayer 助手 应用
- gem 文件中的 gem 'flowplayer'
- rails g flowplayer 或rails g flowplayer 商业广告
- 将 javascript_include_tag 'flowplayer.min.js' 添加到您的 应用程序布局
- 阅读下文
使用
对于 JQuery
= flowplayer_for :video, '/flowplayer.swf', 'jquery' 执行 |玩家| -player.playlist [{:url =>; "video_still.jpg" }, {:url => "video_512x288.flv", :autoPlay => false, :autoBuffering =>真的 }] -player.onLoad 做 - 'this.unmute();'
对于原型
= flowplayer_for :video, '/flowplayer.swf', 'prototype' do |玩家| -player.playlist [{:url =>; "video_still.jpg" }, {:url => "video_512x288.flv", :autoPlay => false, :autoBuffering =>真的 }] -player.onLoad 做 - 'this.unmute();'
这里的配置是相同的
http://flowplayer.org/documentation/api/index.html 待办事项
更多文档
在第 1 步之后,我执行了
bundle install
哪个,结果是成功的。
对于第 2 步,我执行了第一个选项
rails g flowplayer
,结果成功。
对于第 3 步,我将其添加
= javascript_include_tag 'flowplayer.min.js'
到 application.html.haml 文件的头部;这是成功的。
对于第 4 步,我添加
%a#video{:style => "display:block;width:512px;height312px;"}
到我的 home.html.haml 文件中;这是成功的,相当于
<a id='video' style='display:block;width:512px;height312px;'>
现在我已经讲到最后一部分了。我正在使用 jQuery,但我不知道将最后一段代码放在哪里。
任何帮助将非常感谢!
I'm attempting to use the flowplayer gem in my Rails 3 app. I've followed the installation instructions
Flowplayer Helper for Rails 3
applications
- gem 'flowplayer' in your gem file
- rails g flowplayer or rails g flowplayer commercial
- add javascript_include_tag 'flowplayer.min.js' to your
application layout- read below
Usage
For JQuery
= flowplayer_for :video, '/flowplayer.swf', 'jquery' do
|player|
- player.playlist [{:url => "video_still.jpg" }, {:url =>
"video_512x288.flv", :autoPlay =>
false, :autoBuffering => true }]
- player.onLoad do
- 'this.unmute();'For Prototype
= flowplayer_for :video, '/flowplayer.swf', 'prototype' do
|player|
- player.playlist [{:url => "video_still.jpg" }, {:url =>
"video_512x288.flv", :autoPlay =>
false, :autoBuffering => true }]
- player.onLoad do
- 'this.unmute();'Configs are the same ones here
http://flowplayer.org/documentation/api/index.html
TODOMore documentation
After Step 1 I executed
bundle install
Which was successful.
For Step 2, I executed the first option
rails g flowplayer
Which was successful.
For Step 3, I added
= javascript_include_tag 'flowplayer.min.js'
to the head of my application.html.haml file; which was successful.
For Step 4, I added
%a#video{:style => "display:block;width:512px;height312px;"}
to my home.html.haml file; which was successful and the equivalent of
<a id='video' style='display:block;width:512px;height312px;'>
as per this HTML2HAML converter.
Now I've come to the last portion. I am using jQuery, but I have no idea where to put this last snippet of code.
Any help would be great thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道这已经很旧了,但对于其他人来说 - 您可以将最后一段代码放在其余代码之后。警告:最新的 flowplayer gem 中存在一个错误。 flowplayer_for 仅采用两个参数(导致它始终使用 jQuery),而示例显示了三个参数。我已向作者发送了请求以进行更改。
所以(哈姆尔语):
I know this is old but for anyone else - you can put the last bit of code right after the rest of your code. Caveat: There is a bug in the latest flowplayer gem. flowplayer_for only takes two parameters (causing it to always use jQuery) while the example shows three parameters. I've sent the author a pull request to change it.
So (in haml):