flowplayer-rails 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67afeffd58a4e33b61b6d0ea9d50bf8308d6806a
4
+ data.tar.gz: dbfac4381b75e4c7290d5eebae1c8c0ad82a37b9
5
+ SHA512:
6
+ metadata.gz: 21683cd37998590e900571519b867885ceebfc927f512f5498a82df84e259c7c8a5f6b577657a5319f75418b465b1f853f00895e2c32daed0c3fd80a1dae46e5
7
+ data.tar.gz: f76a0a6580dd45589521a3a3d79430789ecc1b9d80f6b706a53beabbb5f68d140c652d7ce538293f00468ac295f5def6f1bb1d2b4afb53d52abef5672e426098
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in flowplayer-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 ryancheung
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Flowplayer::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'flowplayer-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install flowplayer-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/flowplayer-rails/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task test: :spec
7
+
8
+ task default: [:spec]
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'flowplayer/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "flowplayer-rails"
8
+ spec.version = Flowplayer::Rails::VERSION
9
+ spec.authors = ["ryancheung"]
10
+ spec.email = ["ryancheung.go@gmail.com"]
11
+ spec.summary = %q{Use Flowplayer with Rails 3}
12
+ spec.description = %q{This gem provides flowplayer flash player for your Rails 3 application.}
13
+ spec.homepage = "https://github.com/ryancheung/flowplayer-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "railties", ">= 3.0", "< 5.0"
22
+ spec.add_dependency "json"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "nokogiri"
25
+ spec.add_development_dependency "mocha"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.5"
28
+ spec.add_development_dependency "rake"
29
+ end
@@ -0,0 +1 @@
1
+ require 'flowplayer/rails'
@@ -0,0 +1,99 @@
1
+ require 'json'
2
+
3
+ module Flowplayer
4
+ class Player
5
+ attr_accessor :options, :functions, :dom_id, :swf
6
+ def initialize(dom_id, swf, lib='jquery', &block)
7
+ @dom_id, @swf, @lib = dom_id, swf, lib
8
+ @options = {}
9
+ @functions = {}
10
+ block.call(self)
11
+ self
12
+ end
13
+
14
+ def to_js
15
+ json = options_to_javascript
16
+ json += functions_to_javascript
17
+ "{#{json.join(', ')}}"
18
+ end
19
+
20
+ def script_tags
21
+ final = library("flowplayer(\"#{dom_id}\", #{swf.to_json}, #{to_js});")
22
+ <<-EOS
23
+ <script type='text/javascript'>
24
+ //<![CDATA[
25
+ #{final}
26
+ //]]>
27
+ </script>
28
+ EOS
29
+ end
30
+
31
+ def library(func)
32
+ case @lib
33
+ when 'jquery'
34
+ jquery(func)
35
+ when 'prototype'
36
+ prototype(func)
37
+ end
38
+ end
39
+
40
+ def jquery(func)
41
+ <<-EOS
42
+ $(document).ready(function() {
43
+ #{func}
44
+ });
45
+ EOS
46
+ end
47
+
48
+ def prototype(func)
49
+ <<-EOS
50
+ document.observe("dom:loaded", function() {
51
+ #{func}
52
+ });
53
+ EOS
54
+ end
55
+
56
+ def only_play_button!(opts = {})
57
+ options[:plugins] ||= {}
58
+ options[:plugins][:controls] ||= {}
59
+ hash = {
60
+ :mute => false,
61
+ :slowForward => false,
62
+ :time => false,
63
+ :slowBackwards => false,
64
+ :volume => false,
65
+ :scrubber => false,
66
+ :stop => false,
67
+ :fullscreen => false,
68
+ :play => true
69
+ }
70
+ hash.merge!(opts)
71
+ options[:plugins][:controls].merge!(hash)
72
+ end
73
+
74
+
75
+ private
76
+
77
+ def functions_to_javascript
78
+ functions.map {|option, function| "\"#{option}\":#{function}"}
79
+ end
80
+
81
+ def options_to_javascript
82
+ options.map do |option, value|
83
+ "\"#{option}\":#{value.to_json}"
84
+ end
85
+ end
86
+
87
+ def method_missing(method, *args, &block)
88
+ raise "Setters are not supported use method('whatever') to set configs" if /\=$/.match(method.to_s)
89
+ if block.nil?
90
+ options[method] = args.first
91
+ else
92
+ params = block.parameters.collect {|param| param[1]}
93
+ functions[method] = "function(#{params.join(", ")}) { #{block.call.gsub(/\;$/, '')}; }"
94
+ end
95
+ return method
96
+ end
97
+
98
+ end
99
+ end
@@ -0,0 +1,8 @@
1
+ require 'flowplayer/rails/engine'
2
+ require 'flowplayer/rails/railtie'
3
+ require "flowplayer/rails/version"
4
+
5
+ module Flowplayer
6
+ module Rails
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ module Flowplayer
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,22 @@
1
+ require 'flowplayer/player'
2
+
3
+ module Flowplayer
4
+ module Rails
5
+ module Helper
6
+
7
+ # flowplayer_for :hubble do |f|
8
+ # f.option 'foo'
9
+ # f.onLoad do
10
+ # 'this.unmute();'
11
+ # end
12
+ # f.onStart do |clip|
13
+ # 'alert(clip.metaData.width);'
14
+ # end
15
+
16
+ def flowplayer_for(id, swf, lib='jquery', &block)
17
+ Player.new(id, swf, lib, &block).script_tags.html_safe
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,24 @@
1
+ # Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
2
+ # get the minified version of the scripts included into the layout in production.
3
+ require 'flowplayer/rails/helper'
4
+
5
+ module Flowplayer
6
+ module Rails
7
+ class Railtie < ::Rails::Railtie
8
+ config.before_configuration do
9
+ if config.action_view.javascript_expansions
10
+ defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(flowplayer.min) : %w(flowplayer)
11
+
12
+ config.action_view.javascript_expansions[:defaults] |= defaults
13
+ end
14
+ end
15
+
16
+ initializer "flowplayer.configure_rails_initialization" do
17
+ ActionController::Base.instance_eval do
18
+ helper Flowplayer::Rails::Helper
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,6 @@
1
+ module Flowplayer
2
+ module Rails
3
+ VERSION = "0.0.2"
4
+ FLOWPLAYER_VERSION = "3.2.13"
5
+ end
6
+ end
@@ -0,0 +1,43 @@
1
+ require 'rails'
2
+
3
+ # Supply generator for Rails 3.0.x or if asset pipeline is not enabled
4
+ if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled
5
+ module Flowplayer
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+
9
+ desc "This generator installs flowplayer #{Flowplayer::Rails::FLOWPLAYER_VERSION} and its flash assets"
10
+ source_root File.expand_path('../../../../../vendor/assets', __FILE__)
11
+
12
+ def copy_js
13
+ say_status("copying", "flowplayer (#{Flowplayer::Rails::FLOWPLAYER_VERSION})", :green)
14
+ copy_file "javascripts/flowplayer.min.js", "public/javascripts/flowplayer.min.js"
15
+ end
16
+
17
+ def copy_flash
18
+ say_status("copying", "flowplayer (#{Flowplayer::Rails::FLOWPLAYER_VERSION}) flash assets", :green)
19
+ copy_file "flash/flowplayer-3.2.18.swf", "public/flash/flowplayer-3.2.18.swf"
20
+ copy_file "flash/flowplayer.controls-3.2.16.swf", "public/flash/flowplayer.controls-3.2.16.swf"
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ else
27
+ module Flowplayer
28
+ module Generators
29
+ class InstallGenerator < ::Rails::Generators::Base
30
+ desc "Just show instructions so people will know what to do when mistakenly using generator for Rails 3.1 apps"
31
+
32
+ def do_nothing
33
+ say_status("deprecated", "You are using Rails 3.1 with the asset pipeline enabled, so this generator is not needed.")
34
+ say_status("", "The necessary files are already in your asset pipeline.")
35
+ say_status("", "Just add `//= require jquery` and `//= require jquery_ujs` to your app/assets/javascripts/application.js")
36
+ say_status("", "If you upgraded your app from Rails 3.0 and still have jquery.js, rails.js, or jquery_ujs.js in your javascripts, be sure to remove them.")
37
+ say_status("", "If you do not want the asset pipeline enabled, you may turn it off in application.rb and re-run this generator.")
38
+ # ok, nothing
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,81 @@
1
+ require 'spec_helper'
2
+
3
+ describe Flowplayer::Player do
4
+ it "should set options from block" do
5
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
6
+ player.fullscreen true
7
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
8
+ player.onLoad do
9
+ 'this.unmute();'
10
+ end
11
+ player.onStart do |clip|
12
+ 'alert(clip.metaData.width);'
13
+ end
14
+ end
15
+
16
+ flow_player.options[:fullscreen].should == true
17
+ flow_player.functions[:onLoad].should == 'function() { this.unmute(); }'
18
+ flow_player.functions[:onStart].should == 'function(clip) { alert(clip.metaData.width); }'
19
+ flow_player.options[:logo].should be_an(Hash)
20
+
21
+ end
22
+
23
+ it "should set the dom_id to 'my_video'" do
24
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
25
+ player.fullscreen true
26
+ end
27
+ flow_player.dom_id.should == 'my_video'
28
+ end
29
+
30
+ it "should generate valid options" do
31
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
32
+ player.fullscreen true
33
+ player.logo({:opacity => 0, :fullscreenOnly => true})
34
+ player.onLoad do
35
+ 'this.unmute();'
36
+ end
37
+ end
38
+ flow_player.to_js.should include 'fullscreen'
39
+ flow_player.to_js.should match /^\{.+\}$/
40
+ flow_player.to_js.should include({:opacity => 0, :fullscreenOnly => true}.to_json)
41
+ end
42
+
43
+ it "should create script tags with options" do
44
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
45
+ player.fullscreen true
46
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
47
+ player.onLoad do
48
+ 'this.unmute();'
49
+ end
50
+ end
51
+ ["<script", "</script>", "flowplayer(\"my_video\", \"commericial.swf\", #{flow_player.to_js}"].each do |part|
52
+ flow_player.script_tags.should include part
53
+ end
54
+ flow_player.script_tags.should match(/\)\;/)
55
+ end
56
+
57
+ it "should raise exception if passed a setter" do
58
+ lambda do
59
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
60
+ player.fullscreen = true
61
+ end
62
+ end.should raise_error
63
+ end
64
+
65
+ it "should support jquery" do
66
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf') do |player|
67
+ player.fullscreen true
68
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
69
+ end
70
+ flow_player.should include('$(document).ready(function(){')
71
+ end
72
+
73
+ it "should support prototype" do
74
+ flow_player = Flowplayer::Player.new('my_video', 'commericial.swf', 'prototype') do |player|
75
+ player.fullscreen true
76
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
77
+ end
78
+ flow_player.should include('document.observe(function(){')
79
+ end
80
+ end
81
+
@@ -0,0 +1,30 @@
1
+ class String
2
+ def html_safe
3
+ self
4
+ end
5
+ end
6
+
7
+ describe Flowplayer::Rails::Helper do
8
+ include Flowplayer::Rails::Helper
9
+
10
+
11
+
12
+ it "should render player" do
13
+ flow_player = flowplayer_for('my_video', 'commericial.swf') do |player|
14
+ player.fullscreen true
15
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
16
+ end
17
+ flow_player.should include('$(document).ready(function() {')
18
+ end
19
+
20
+
21
+
22
+ it "should support prototype" do
23
+ flow_player = flowplayer_for('my_video', 'commericial.swf', 'prototype') do |player|
24
+ player.fullscreen true
25
+ player.logo(:url => nil, :opacity => 0, :fullscreenOnly => true)
26
+ end
27
+ flow_player.should include('document.observe("dom:loaded", function() {')
28
+ end
29
+
30
+ end
@@ -0,0 +1,2 @@
1
+ require File.expand_path('../../lib/flowplayer/player', __FILE__)
2
+ require File.expand_path('../../lib/flowplayer/rails/helper', __FILE__)
data/vendor/.DS_Store ADDED
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,22 @@
1
+ /*
2
+ * flowplayer.js The Flowplayer API
3
+ *
4
+ * Copyright 2009-2011 Flowplayer Oy
5
+ *
6
+ * This file is part of Flowplayer.
7
+ *
8
+ * Flowplayer is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * Flowplayer is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with Flowplayer. If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+ !function(){function h(p){console.log("$f.fireEvent",[].slice.call(p))}function l(r){if(!r||typeof r!="object"){return r}var p=new r.constructor();for(var q in r){if(r.hasOwnProperty(q)){p[q]=l(r[q])}}return p}function n(u,r){if(!u){return}var p,q=0,s=u.length;if(s===undefined){for(p in u){if(r.call(u[p],p,u[p])===false){break}}}else{for(var t=u[0];q<s&&r.call(t,q,t)!==false;t=u[++q]){}}return u}function c(p){return document.getElementById(p)}function j(r,q,p){if(typeof q!="object"){return r}if(r&&q){n(q,function(s,t){if(!p||typeof t!="function"){r[s]=t}})}return r}function o(t){var r=t.indexOf(".");if(r!=-1){var q=t.slice(0,r)||"*";var p=t.slice(r+1,t.length);var s=[];n(document.getElementsByTagName(q),function(){if(this.className&&this.className.indexOf(p)!=-1){s.push(this)}});return s}}function g(p){p=p||window.event;if(p.preventDefault){p.stopPropagation();p.preventDefault()}else{p.returnValue=false;p.cancelBubble=true}return false}function k(r,p,q){r[p]=r[p]||[];r[p].push(q)}function e(p){return p.replace(/&amp;/g,"%26").replace(/&/g,"%26").replace(/=/g,"%3D")}function f(){return"_"+(""+Math.random()).slice(2,10)}var i=function(u,s,t){var r=this,q={},v={};r.index=s;if(typeof u=="string"){u={url:u}}j(this,u,true);n(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var w="on"+this;if(w.indexOf("*")!=-1){w=w.slice(0,w.length-1);var x="onBefore"+w.slice(2);r[x]=function(y){k(v,x,y);return r}}r[w]=function(y){k(v,w,y);return r};if(s==-1){if(r[x]){t[x]=r[x]}if(r[w]){t[w]=r[w]}}});j(this,{onCuepoint:function(y,x){if(arguments.length==1){q.embedded=[null,y];return r}if(typeof y=="number"){y=[y]}var w=f();q[w]=[y,x];if(t.isLoaded()){t._api().fp_addCuepoints(y,s,w)}return r},update:function(x){j(r,x);if(t.isLoaded()){t._api().fp_updateClip(x,s)}var w=t.getConfig();var y=(s==-1)?w.clip:w.playlist[s];j(y,x,true)},_fireEvent:function(w,z,x,B){if(w=="onLoad"){n(q,function(C,D){if(D[0]){t._api().fp_addCuepoints(D[0],s,C)}});return false}B=B||r;if(w=="onCuepoint"){var A=q[z];if(A){return A[1].call(t,B,x)}}if(z&&"onBeforeBegin,onMetaData,onMetaDataChange,onStart,onUpdate,onResume".indexOf(w)!=-1){j(B,z);if(z.metaData){if(!B.duration){B.duration=z.metaData.duration}else{B.fullDuration=z.metaData.duration}}}var y=true;n(v[w],function(){y=this.call(t,B,z,x)});return y}});if(u.onCuepoint){var p=u.onCuepoint;r.onCuepoint.apply(r,typeof p=="function"?[p]:p);delete u.onCuepoint}n(u,function(w,x){if(typeof x=="function"){k(v,w,x);delete u[w]}});if(s==-1){t.onCuepoint=this.onCuepoint}};var m=function(q,s,r,u){var p=this,t={},v=false;if(u){j(t,u)}n(s,function(w,x){if(typeof x=="function"){t[w]=x;delete s[w]}});j(this,{animate:function(z,A,y){if(!z){return p}if(typeof A=="function"){y=A;A=500}if(typeof z=="string"){var x=z;z={};z[x]=A;A=500}if(y){var w=f();t[w]=y}if(A===undefined){A=500}s=r._api().fp_animate(q,z,A,w);return p},css:function(x,y){if(y!==undefined){var w={};w[x]=y;x=w}s=r._api().fp_css(q,x);j(p,s);return p},show:function(){this.display="block";r._api().fp_showPlugin(q);return p},hide:function(){this.display="none";r._api().fp_hidePlugin(q);return p},toggle:function(){this.display=r._api().fp_togglePlugin(q);return p},fadeTo:function(z,y,x){if(typeof y=="function"){x=y;y=500}if(x){var w=f();t[w]=x}this.display=r._api().fp_fadeTo(q,z,y,w);this.opacity=z;return p},fadeIn:function(x,w){return p.fadeTo(1,x,w)},fadeOut:function(x,w){return p.fadeTo(0,x,w)},getName:function(){return q},getPlayer:function(){return r},_fireEvent:function(x,w,y){if(x=="onUpdate"){var A=r._api().fp_getPlugin(q);if(!A){return}j(p,A);delete p.methods;if(!v){n(A.methods,function(){var C=""+this;p[C]=function(){var D=[].slice.call(arguments);var E=r._api().fp_invoke(q,C,D);return E==="undefined"||E===undefined?p:E}});v=true}}var B=t[x];if(B){var z=B.apply(p,w);if(x.slice(0,1)=="_"){delete t[x]}return z}return p}})};function b(r,H,u){var x=this,w=null,E=false,v,t,G=[],z={},y={},F,s,q,D,p,B;j(x,{id:function(){return F},isLoaded:function(){return(w!==null&&w.fp_play!==undefined&&!E)},getParent:function(){return r},hide:function(I){if(I){r.style.height="0px"}if(x.isLoaded()){w.style.height="0px"}return x},show:function(){r.style.height=B+"px";if(x.isLoaded()){w.style.height=p+"px"}return x},isHidden:function(){return x.isLoaded()&&parseInt(w.style.height,10)===0},load:function(K){if(!x.isLoaded()&&x._fireEvent("onBeforeLoad")!==false){var I=function(){if(v&&!flashembed.isSupported(H.version)){r.innerHTML=""}if(K){K.cached=true;k(y,"onLoad",K)}flashembed(r,H,{config:u})};var J=0;n(a,function(){this.unload(function(L){if(++J==a.length){I()}})})}return x},unload:function(K){if(v.replace(/\s/g,"")!==""){if(x._fireEvent("onBeforeUnload")===false){if(K){K(false)}return x}E=true;try{if(w){if(w.fp_isFullscreen()){w.fp_toggleFullscreen()}w.fp_close();x._fireEvent("onUnload")}}catch(I){}var J=function(){w=null;r.innerHTML=v;E=false;if(K){K(true)}};if(/WebKit/i.test(navigator.userAgent)&&!/Chrome/i.test(navigator.userAgent)){setTimeout(J,0)}else{J()}}else{if(K){K(false)}}return x},getClip:function(I){if(I===undefined){I=D}return G[I]},getCommonClip:function(){return t},getPlaylist:function(){return G},getPlugin:function(I){var K=z[I];if(!K&&x.isLoaded()){var J=x._api().fp_getPlugin(I);if(J){K=new m(I,J,x);z[I]=K}}return K},getScreen:function(){return x.getPlugin("screen")},getControls:function(){return x.getPlugin("controls")._fireEvent("onUpdate")},getLogo:function(){try{return x.getPlugin("logo")._fireEvent("onUpdate")}catch(I){}},getPlay:function(){return x.getPlugin("play")._fireEvent("onUpdate")},getConfig:function(I){return I?l(u):u},getFlashParams:function(){return H},loadPlugin:function(L,K,N,M){if(typeof N=="function"){M=N;N={}}var J=M?f():"_";x._api().fp_loadPlugin(L,K,N,J);var I={};I[J]=M;var O=new m(L,null,x,I);z[L]=O;return O},getState:function(){return x.isLoaded()?w.fp_getState():-1},play:function(J,I){var K=function(){if(J!==undefined){x._api().fp_play(J,I)}else{x._api().fp_play()}};if(x.isLoaded()){K()}else{if(E){setTimeout(function(){x.play(J,I)},50)}else{x.load(function(){K()})}}return x},getVersion:function(){var J="flowplayer.js @VERSION";if(x.isLoaded()){var I=w.fp_getVersion();I.push(J);return I}return J},_api:function(){if(!x.isLoaded()){throw"Flowplayer "+x.id()+" not loaded when calling an API method"}return w},setClip:function(I){n(I,function(J,K){if(typeof K=="function"){k(y,J,K);delete I[J]}else{if(J=="onCuepoint"){$f(r).getCommonClip().onCuepoint(I[J][0],I[J][1])}}});x.setPlaylist([I]);return x},getIndex:function(){return q},bufferAnimate:function(I){w.fp_bufferAnimate(I===undefined||I);return x},_swfHeight:function(){return w.clientHeight}});n(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error,MouseOver,MouseOut").split(","),function(){var I="on"+this;if(I.indexOf("*")!=-1){I=I.slice(0,I.length-1);var J="onBefore"+I.slice(2);x[J]=function(K){k(y,J,K);return x}}x[I]=function(K){k(y,I,K);return x}});n(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip,playFeed,setKeyboardShortcutsEnabled,isKeyboardShortcutsEnabled").split(","),function(){var I=this;x[I]=function(K,J){if(!x.isLoaded()){return x}var L=null;if(K!==undefined&&J!==undefined){L=w["fp_"+I](K,J)}else{L=(K===undefined)?w["fp_"+I]():w["fp_"+I](K)}return L==="undefined"||L===undefined?x:L}});x._fireEvent=function(R){if(typeof R=="string"){R=[R]}var S=R[0],P=R[1],N=R[2],M=R[3],L=0;if(u.debug){h(R)}if(!x.isLoaded()&&S=="onLoad"&&P=="player"){w=w||c(s);p=x._swfHeight();n(G,function(){this._fireEvent("onLoad")});n(z,function(T,U){U._fireEvent("onUpdate")});t._fireEvent("onLoad")}if(S=="onLoad"&&P!="player"){return}if(S=="onError"){if(typeof P=="string"||(typeof P=="number"&&typeof N=="number")){P=N;N=M}}if(S=="onContextMenu"){n(u.contextMenu[P],function(T,U){U.call(x)});return}if(S=="onPluginEvent"||S=="onBeforePluginEvent"){var I=P.name||P;var J=z[I];if(J){J._fireEvent("onUpdate",P);return J._fireEvent(N,R.slice(3))}return}if(S=="onPlaylistReplace"){G=[];var O=0;n(P,function(){G.push(new i(this,O++,x))})}if(S=="onClipAdd"){if(P.isInStream){return}P=new i(P,N,x);G.splice(N,0,P);for(L=N+1;L<G.length;L++){G[L].index++}}var Q=true;if(typeof P=="number"&&P<G.length){D=P;var K=G[P];if(K){Q=K._fireEvent(S,N,M)}if(!K||Q!==false){Q=t._fireEvent(S,N,M,K)}}n(y[S],function(){Q=this.call(x,P,N);if(this.cached){y[S].splice(L,1)}if(Q===false){return false}L++});return Q};function C(){if($f(r)){$f(r).getParent().innerHTML="";q=$f(r).getIndex();a[q]=x}else{a.push(x);q=a.length-1}B=parseInt(r.style.height,10)||r.clientHeight;F=r.id||"fp"+f();s=H.id||F+"_api";H.id=s;v=r.innerHTML;if(typeof u=="string"){u={clip:{url:u}}}u.playerId=F;u.clip=u.clip||{};if(r.getAttribute("href",2)&&!u.clip.url){u.clip.url=r.getAttribute("href",2)}if(u.clip.url){u.clip.url=e(u.clip.url)}t=new i(u.clip,-1,x);u.playlist=u.playlist||[u.clip];var J=0;n(u.playlist,function(){var M=this;if(typeof M=="object"&&M.length){M={url:""+M}}if(M.url){M.url=e(M.url)}n(u.clip,function(N,O){if(O!==undefined&&M[N]===undefined&&typeof O!="function"){M[N]=O}});u.playlist[J]=M;M=new i(M,J,x);G.push(M);J++});n(u,function(M,N){if(typeof N=="function"){if(t[M]){t[M](N)}else{k(y,M,N)}delete u[M]}});n(u.plugins,function(M,N){if(N){z[M]=new m(M,N,x)}});if(!u.plugins||u.plugins.controls===undefined){z.controls=new m("controls",null,x)}z.canvas=new m("canvas",null,x);v=r.innerHTML;function L(M){if(/iPad|iPhone|iPod/i.test(navigator.userAgent)&&!/.flv$/i.test(G[0].url)&&!K()){return true}if(!x.isLoaded()&&x._fireEvent("onBeforeClick")!==false){x.load()}return g(M)}function K(){return x.hasiPadSupport&&x.hasiPadSupport()}function I(){if(v.replace(/\s/g,"")!==""){if(r.addEventListener){r.addEventListener("click",L,false)}else{if(r.attachEvent){r.attachEvent("onclick",L)}}}else{if(r.addEventListener&&!K()){r.addEventListener("click",g,false)}x.load()}}setTimeout(I,0)}if(typeof r=="string"){var A=c(r);if(!A){throw"Flowplayer cannot access element: "+r}r=A;C()}else{C()}}var a=[];function d(p){this.length=p.length;this.each=function(r){n(p,r)};this.size=function(){return p.length};var q=this;for(name in b.prototype){q[name]=function(){var r=arguments;q.each(function(){this[name].apply(this,r)})}}}window.flowplayer=window.$f=function(){var q=null;var p=arguments[0];if(!arguments.length){n(a,function(){if(this.isLoaded()){q=this;return false}});return q||a[0]}if(arguments.length==1){if(typeof p=="number"){return a[p]}else{if(p=="*"){return new d(a)}n(a,function(){if(this.id()==p.id||this.id()==p||this.getParent()==p){q=this;return false}});return q}}if(arguments.length>1){var u=arguments[1],r=(arguments.length==3)?arguments[2]:{};if(typeof u=="string"){u={src:u}}u=j({bgcolor:"#000000",version:[10,1],expressInstall:"http://releases.flowplayer.org/swf/expressinstall.swf",cachebusting:false},u);if(typeof p=="string"){if(p.indexOf(".")!=-1){var t=[];n(o(p),function(){t.push(new b(this,l(u),l(r)))});return new d(t)}else{var s=c(p);return new b(s!==null?s:l(p),l(u),l(r))}}else{if(p){return new b(p,l(u),l(r))}}}return null};j(window.$f,{fireEvent:function(){var q=[].slice.call(arguments);var r=$f(q[0]);return r?r._fireEvent(q.slice(1)):null},addPlugin:function(p,q){b.prototype[p]=q;return $f},each:n,extend:j});if(typeof jQuery=="function"){jQuery.fn.flowplayer=function(r,q){if(!arguments.length||typeof arguments[0]=="number"){var p=[];this.each(function(){var s=$f(this);if(s){p.push(s)}});return arguments.length?p[arguments[0]]:new d(p)}return this.each(function(){$f(this,l(r),q?l(q):{})})}}}();!function(){var h=document.all,j="http://get.adobe.com/flashplayer",c=typeof jQuery=="function",e=/(\d+)[^\d]+(\d+)[^\d]*(\d*)/,b={width:"100%",height:"100%",id:"_"+(""+Math.random()).slice(9),allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:[3,0],onFail:null,expressInstall:null,w3c:false,cachebusting:false};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function i(m,l){if(l){for(var f in l){if(l.hasOwnProperty(f)){m[f]=l[f]}}}return m}function a(f,n){var m=[];for(var l in f){if(f.hasOwnProperty(l)){m[l]=n(f[l])}}return m}window.flashembed=function(f,m,l){if(typeof f=="string"){f=document.getElementById(f.replace("#",""))}if(!f){return}if(typeof m=="string"){m={src:m}}return new d(f,i(i({},b),m),l)};var g=i(window.flashembed,{conf:b,getVersion:function(){var m,f,o;try{o=navigator.plugins["Shockwave Flash"];if(o[0].enabledPlugin!=null){f=o.description.slice(16)}}catch(p){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");f=m&&m.GetVariable("$version")}catch(n){try{m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");f=m&&m.GetVariable("$version")}catch(l){}}}f=e.exec(f);return f?[1*f[1],1*f[(f[1]*1>9?2:3)]*1]:[0,0]},asString:function(l){if(l===null||l===undefined){return null}var f=typeof l;if(f=="object"&&l.push){f="array"}switch(f){case"string":l=l.replace(new RegExp('(["\\\\])',"g"),"\\$1");l=l.replace(/^\s?(\d+\.?\d*)%/,"$1pct");return'"'+l+'"';case"array":return"["+a(l,function(o){return g.asString(o)}).join(",")+"]";case"function":return'"function()"';case"object":var m=[];for(var n in l){if(l.hasOwnProperty(n)){m.push('"'+n+'":'+g.asString(l[n]))}}return"{"+m.join(",")+"}"}return String(l).replace(/\s/g," ").replace(/\'/g,'"')},getHTML:function(o,l){o=i({},o);var n='<object width="'+o.width+'" height="'+o.height+'" id="'+o.id+'" name="'+o.id+'"';if(o.cachebusting){o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random())}if(o.w3c||!h){n+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{n+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}n+=">";if(o.w3c||h){n+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;o.onFail=o.version=o.expressInstall=null;for(var m in o){if(o[m]){n+='<param name="'+m+'" value="'+o[m]+'" />'}}var p="";if(l){for(var f in l){if(l[f]){var q=l[f];p+=f+"="+(/function|object/.test(typeof q)?g.asString(q):q)+"&"}}p=p.slice(0,-1);n+='<param name="flashvars" value=\''+p+"' />"}n+="</object>";return n},isSupported:function(f){return k[0]>f[0]||k[0]==f[0]&&k[1]>=f[1]}});var k=g.getVersion();function d(f,n,m){if(g.isSupported(n.version)){f.innerHTML=g.getHTML(n,m)}else{if(n.expressInstall&&g.isSupported([6,65])){f.innerHTML=g.getHTML(i(n,{src:n.expressInstall}),{MMredirectURL:encodeURIComponent(location.href),MMplayerType:"PlugIn",MMdoctitle:document.title})}else{if(!f.innerHTML.replace(/\s/g,"")){f.innerHTML="<h2>Flash version "+n.version+" or greater is required</h2><h3>"+(k[0]>0?"Your version is "+k:"You have no flash plugin installed")+"</h3>"+(f.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='"+j+"'>here</a></p>");if(f.tagName=="A"||f.tagName=="DIV"){f.onclick=function(){location.href=j}}}if(n.onFail){var l=n.onFail.call(this);if(typeof l=="string"){f.innerHTML=l}}}}if(h){window[n.id]=document.getElementById(n.id)}i(this,{getRoot:function(){return f},getOptions:function(){return n},getConf:function(){return m},getApi:function(){return f.firstChild}})}if(c){jQuery.tools=jQuery.tools||{version:"@VERSION"};jQuery.tools.flashembed={conf:b};jQuery.fn.flashembed=function(l,f){return this.each(function(){$(this).data("flashembed",flashembed(this,l,f))})}}}();
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flowplayer-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - ryancheung
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: nokogiri
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: mocha
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ - !ruby/object:Gem::Dependency
90
+ name: bundler
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '1.5'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '1.5'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rake
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ description: This gem provides flowplayer flash player for your Rails 3 application.
118
+ email:
119
+ - ryancheung.go@gmail.com
120
+ executables: []
121
+ extensions: []
122
+ extra_rdoc_files: []
123
+ files:
124
+ - .gitignore
125
+ - Gemfile
126
+ - LICENSE.txt
127
+ - README.md
128
+ - Rakefile
129
+ - flowplayer-rails.gemspec
130
+ - lib/flowplayer-rails.rb
131
+ - lib/flowplayer/player.rb
132
+ - lib/flowplayer/rails.rb
133
+ - lib/flowplayer/rails/engine.rb
134
+ - lib/flowplayer/rails/helper.rb
135
+ - lib/flowplayer/rails/railtie.rb
136
+ - lib/flowplayer/rails/version.rb
137
+ - lib/generators/flowplayer/install/install_generator.rb
138
+ - spec/flowplayer_spec.rb
139
+ - spec/rails_helper_spec.rb
140
+ - spec/spec_helper.rb
141
+ - vendor/.DS_Store
142
+ - vendor/assets/.DS_Store
143
+ - vendor/assets/flash/.DS_Store
144
+ - vendor/assets/flash/flowplayer-3.2.18.swf
145
+ - vendor/assets/flash/flowplayer.controls-3.2.16.swf
146
+ - vendor/assets/javascripts/.DS_Store
147
+ - vendor/assets/javascripts/flowplayer.min.js
148
+ homepage: https://github.com/ryancheung/flowplayer-rails
149
+ licenses:
150
+ - MIT
151
+ metadata: {}
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 2.0.14
169
+ signing_key:
170
+ specification_version: 4
171
+ summary: Use Flowplayer with Rails 3
172
+ test_files:
173
+ - spec/flowplayer_spec.rb
174
+ - spec/rails_helper_spec.rb
175
+ - spec/spec_helper.rb
176
+ has_rdoc: