ooyala-rails 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab721a5ab07f725f1d7b42d7642a59410fa78d03
4
- data.tar.gz: fe1723e84b0c71965398df34bfd678abffa8756c
3
+ metadata.gz: 8271fc78f88ca0445e95108705d34e21a2ee7a2f
4
+ data.tar.gz: 4ecb824ad782e3188522034e5c94b82dc4c1a973
5
5
  SHA512:
6
- metadata.gz: 416845241a4e4e986935ca5a2876b1b3d722ddd1312bfc0ab2bf70e6066b5903b84ba380fee98f3ca274bdc1c805113f9db9f6766014ceb6c0a68e3d9937346d
7
- data.tar.gz: 1fe12a1b22592bfbe25b65ffab20cf14b9ebfb73eecedd5adad2b0feeecd4b8f914558233edd3781479a788ae003b6e36989bf26c87a36faa1d3fa259f577fe8
6
+ metadata.gz: 6529597444b4508e4d90f00970c393388702baef26f365090b1d6e2c6cb06e490ca5879969f1583c7d55648bc63fef28f021866991d36a39894909ba316b0a6a
7
+ data.tar.gz: 65ff9b19b174aa66f9859e590741ddefed0428008343761488305cb8caa9bd6c6ac513d35d25303e9553de4f209d10594b65cce3e3861d5ad10ff7daa1730b36
data/README.md CHANGED
@@ -30,25 +30,25 @@ Ideally, use ENV variables instead of storing your credentials in version contro
30
30
 
31
31
  ## Usage
32
32
 
33
- To render a player:
33
+ First, render the JS:
34
34
 
35
- ```erb
36
- <%= ooyala_player 'your_embed_code' %>
37
- ```
35
+ ```erb
36
+ <!-- using configured player_id -->
37
+ <%= ooyala_js %>
38
38
 
39
- This only works when `player_id` is configured.
40
-
41
- To specify `player_id`:
39
+ <!-- specifying player_id -->
40
+ <%= ooyala_js player_id: 'PLAYER_ID_GOES_HERE' %>
41
+ ```
42
42
 
43
- ```erb
44
- <%= ooyala_player 'your_embed_code', player_id: 'PLAYER_ID_GOES_HERE' %>
45
- ```
43
+ Next, render your player(s):
46
44
 
47
- To add/override player options:
45
+ ```erb
46
+ <!-- using configured player_id and default player options -->
47
+ <%= ooyala_player 'your_embed_code' %>
48
48
 
49
- ```erb
50
- <%= ooyala_player 'your_embed_code', options: {autoplay: true} %>
51
- ```
49
+ <!-- specifying player_id and player options -->
50
+ <%= ooyala_player 'your_embed_code', player_id: 'PLAYER_ID_GOES_HERE', options: {autoplay: true} %>
51
+ ```
52
52
 
53
53
  The generated container `<div>` will require some basic CSS, eg:
54
54
 
@@ -1,16 +1,21 @@
1
1
  module OoyalaHelper
2
+ # Generates Ooyala player JS
3
+ def ooyala_js(player_id: default_ooyala_player_id)
4
+ javascript_include_tag "//player.ooyala.com/v3/#{player_id}"
5
+ end
6
+
2
7
  # Renders Ooyala player
3
- def ooyala_player(embed_code,
4
- div_id: embed_code,
5
- player_id: Ooyala::Rails.config.player_id,
6
- options: Ooyala::Rails.config.player_options || {})
7
- @loaded_ooyala_js ||= Set.new
8
- render('ooyala_player',
9
- embed_code: embed_code,
10
- div_id: div_id,
11
- player_id: player_id,
12
- options: options).tap do |_|
13
- @loaded_ooyala_js << player_id
14
- end
8
+ def ooyala_player(embed_code, div_id: embed_code, options: default_ooyala_player_options)
9
+ render 'ooyala_player', embed_code: embed_code, div_id: div_id, options: options.to_json.html_safe
10
+ end
11
+
12
+ private
13
+
14
+ def default_ooyala_player_id
15
+ Ooyala::Rails.config.player_id
16
+ end
17
+
18
+ def default_ooyala_player_options
19
+ Ooyala::Rails.config.player_options || {}
15
20
  end
16
21
  end
@@ -1,9 +1,6 @@
1
- <% unless @loaded_ooyala_js.include?(player_id) %>
2
- <script src="http://player.ooyala.com/v3/<%= player_id %>"></script>
3
- <% end %>
4
1
  <div class="ooyala-player" id="<%= div_id %>"></div>
5
2
  <script type="text/javascript" charset="utf-8">
6
3
  OO.ready(function() {
7
- window.player = OO.Player.create('<%= div_id %>', '<%= embed_code %>', <%= raw options.to_json %>);
4
+ window.player = OO.Player.create('<%= div_id %>', '<%= embed_code %>', <%= options %>);
8
5
  });
9
6
  </script>
@@ -1,5 +1,5 @@
1
1
  module Ooyala
2
2
  module Rails
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ooyala-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zubin Henner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-04 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails