Rails 3 Flowplayer Gem 用法

发布于 2024-10-21 12:27:55 字数 1889 浏览 7 评论 0原文

我正在尝试在我的 Rails 3 应用程序中使用 flowplayer gem 。我已按照安装说明进行操作

Rails 3 的 Flowplayer 助手 应用

  1. gem 文件中的 gem 'flowplayer'
  2. rails g flowplayer 或rails g flowplayer 商业广告
  3. 将 javascript_include_tag 'flowplayer.min.js' 添加到您的 应用程序布局
  4. 阅读下文

使用

对于 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;'>

这个 HTML2HAML 转换器

现在我已经讲到最后一部分了。我正在使用 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

  1. gem 'flowplayer' in your gem file
  2. rails g flowplayer or rails g flowplayer commercial
  3. add javascript_include_tag 'flowplayer.min.js' to your
    application layout
  4. 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
TODO

More 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

匿名的好友 2024-10-28 12:27:55

我知道这已经很旧了,但对于其他人来说 - 您可以将最后一段代码放在其余代码之后。警告:最新的 flowplayer gem 中存在一个错误。 flowplayer_for 仅采用两个参数(导致它始终使用 jQuery),而示例显示了三个参数。我已向作者发送了请求以进行更改。

所以(哈姆尔语):

- content_for :head do
  = javascript_include_tag "flowplayer.min.js"

%a#video{:style => "display:block;width:512px;height312px;"}

= flowplayer_for :video, '/flowplayer.swf'do |player|
  - player.playlist [{:url => "video_still.jpg" }, {:url => "video_512x288.flv", :autoPlay => false, :autoBuffering => true }] 
  - player.onLoad do 
    - 'this.unmute();' 

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):

- content_for :head do
  = javascript_include_tag "flowplayer.min.js"

%a#video{:style => "display:block;width:512px;height312px;"}

= flowplayer_for :video, '/flowplayer.swf'do |player|
  - player.playlist [{:url => "video_still.jpg" }, {:url => "video_512x288.flv", :autoPlay => false, :autoBuffering => true }] 
  - player.onLoad do 
    - 'this.unmute();' 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文