videojs_rails 4.12.5 → 4.12.6.1

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: c2f9232ee43e7982e17d42a390b44605495f6c43
4
- data.tar.gz: 3b717ca17be9e535d555016464d14a4bc30a807e
3
+ metadata.gz: eb92eacedf89b4ae3d2540561bb437036043e1bf
4
+ data.tar.gz: a982d5cbf412773b0607d1614eeb4f6cb3d0ce23
5
5
  SHA512:
6
- metadata.gz: 4c8e29bb0dd3a6cbdd2ecb31e8d86fb1bb5a2a517b7c927feb1d24525adac5048ef57b51902ba8a18b1d1873dc9b68a352be3691083f2b573bfb444493d98d5f
7
- data.tar.gz: d2e9f57db429627fadc13675c24458113322ce8f295bee3678ecda192279a1032ad51e9bf9d4ba664a55697bc11d6965c5b3a1fefb146fcf8aebd949ac26b0a2
6
+ metadata.gz: 023cd67d03a51549036b87bb4490f05b53c8659f0c033e53f35cd43d536da63e80b9b2d29f6e4ba65e448aea71cc372fb4fe88b5a61cfb90a418193d73e54f3f
7
+ data.tar.gz: 9a74891f2c1183aa2db23785cf62f49e7bf9d6cbfcd7fbec0059a6442b08cf6a003ac88e4048ad45882112bbb3d6e13c240155b34a37941a523ca31c1d72aeb6
@@ -1,3 +1,3 @@
1
1
  module VideojsRails
2
- VERSION = '4.12.5'
2
+ VERSION = '4.12.6.1'
3
3
  end
@@ -1,12 +1,72 @@
1
1
  module VideojsRails
2
2
  module ViewHelpers
3
- def videojs_rails(*options, &blk)
4
- default_options = {
3
+ DEFAULT_OPTIONS = {
5
4
  controls: true,
6
- preload: "auto"
5
+ preload: :auto
6
+ }.freeze
7
+
8
+ def videojs_rails(user_options, &blk)
9
+ sources, captions, options = prepare_options(user_options)
10
+ generate_tag(options, sources, captions, &blk)
11
+ end
12
+
13
+ private
14
+
15
+ def prepare_options(user_options)
16
+ options = DEFAULT_OPTIONS.merge(user_options)
17
+ options[:'data-setup'] = options.delete(:setup) if options.key?(:setup)
18
+ options[:class] = [options[:class], "video-js vjs-default-skin"].join(' ')
19
+
20
+ [options.delete(:sources), options.delete(:captions), options]
21
+ end
22
+
23
+ def generate_sources(sources)
24
+ return if sources.blank?
25
+ sources.each do |type, source|
26
+ concat tag(:source, src: source, type: "video/#{ type }")
27
+ end
28
+ end
29
+
30
+ def generate_captions(captions, options)
31
+ return if captions.blank?
32
+ captions.each do |lang, caption|
33
+ src, label = extract_caption_information(caption)
34
+ caption_options = prepare_caption_options(src, lang, label, options)
35
+
36
+ concat tag(:track, caption_options)
37
+ end
38
+ end
39
+
40
+ def extract_caption_information(caption)
41
+ if caption.is_a?(Hash)
42
+ caption.values_at(:src, :label)
43
+ else
44
+ caption
45
+ end
46
+ end
47
+
48
+ def prepare_caption_options(src, lang, label, options)
49
+ default_caption_language = options[:default_caption_language].try(:to_sym)
50
+ {
51
+ kind: :captions,
52
+ src: src,
53
+ srclang: lang,
54
+ label: label,
55
+ default: default_caption_language == lang.to_sym
7
56
  }
8
- options = default_options.merge(options.extract_options!)
9
- render partial: 'videojs_rails/videojs_rails', locals: { options: options }, &blk
57
+ end
58
+
59
+ def generate_tag(options, sources, captions, &blk)
60
+ content_tag(:video, options) do
61
+ generate_sources(sources)
62
+ generate_captions(captions, options)
63
+ generate_no_js(&blk)
64
+ end
65
+ end
66
+
67
+ def generate_no_js
68
+ return unless block_given?
69
+ concat content_tag(:p, yield, class: :'vjs-no-js')
10
70
  end
11
71
  end
12
72
  end
@@ -80,7 +80,7 @@ vjs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'ht
80
80
  * Full player version
81
81
  * @type {string}
82
82
  */
83
- vjs['VERSION'] = '4.12.5';
83
+ vjs['VERSION'] = '4.12.6';
84
84
 
85
85
  /**
86
86
  * Global Player instance options, surfaced from vjs.Player.prototype.options_
@@ -7774,12 +7774,6 @@ vjs.Flash = vjs.MediaTechController.extend({
7774
7774
 
7775
7775
  var source = options['source'],
7776
7776
 
7777
- // Which element to embed in
7778
- parentEl = options['parentEl'],
7779
-
7780
- // Create a temporary element to be replaced by swf object
7781
- placeHolder = this.el_ = vjs.createEl('div', { id: player.id() + '_temp_flash' }),
7782
-
7783
7777
  // Generate ID for swf object
7784
7778
  objId = player.id()+'_flash_api',
7785
7779
 
@@ -7826,7 +7820,7 @@ vjs.Flash = vjs.MediaTechController.extend({
7826
7820
  }
7827
7821
 
7828
7822
  // Add placeholder to player div
7829
- vjs.insertFirst(placeHolder, parentEl);
7823
+ vjs.insertFirst(this.el_, options['parentEl']);
7830
7824
 
7831
7825
  // Having issues with Flash reloading on certain page actions (hide/resize/fullscreen) in certain browsers
7832
7826
  // This allows resetting the playhead when we catch the reload
@@ -7853,7 +7847,7 @@ vjs.Flash = vjs.MediaTechController.extend({
7853
7847
  // use stageclick events triggered from inside the SWF instead
7854
7848
  player.on('stageclick', player.reportUserActivity);
7855
7849
 
7856
- this.el_ = vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
7850
+ this.el_ = vjs.Flash.embed(options['swf'], this.el_, flashVars, params, attributes);
7857
7851
  }
7858
7852
  });
7859
7853
 
@@ -8120,6 +8114,7 @@ vjs.Flash.embed = function(swf, placeHolder, flashVars, params, attributes){
8120
8114
  ;
8121
8115
 
8122
8116
  placeHolder.parentNode.replaceChild(obj, placeHolder);
8117
+ obj[vjs.expando] = placeHolder[vjs.expando];
8123
8118
 
8124
8119
  // IE6 seems to have an issue where it won't initialize the swf object after injecting it.
8125
8120
  // This is a dumb fix
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  Video.js Default Styles (http://videojs.com)
3
- Version 4.12.5
3
+ Version 4.12.6
4
4
  Create your own skin at http://designer.videojs.com
5
5
  */
6
6
  /* SKIN
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: videojs_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.12.5
4
+ version: 4.12.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Behan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-19 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: HTML5 VideoJS plugin
14
14
  email:
@@ -20,7 +20,6 @@ files:
20
20
  - ".gitignore"
21
21
  - Gemfile
22
22
  - Rakefile
23
- - app/views/videojs_rails/_videojs_rails.html.erb
24
23
  - lib/videojs_rails.rb
25
24
  - lib/videojs_rails/engine.rb
26
25
  - lib/videojs_rails/railtie.rb
@@ -1,33 +0,0 @@
1
- <%= content_tag(:video,
2
- id: options[:id],
3
- class: "#{ options[:classes] } vide-js vjs-default-skin",
4
- controls: options[:controls],
5
- loop: options[:loop],
6
- autoplay: options[:autoplay],
7
- preload: options[:preload],
8
- width: options[:width],
9
- height: options[:height],
10
- poster: options[:poster],
11
- 'data-setup' => options[:setup]) do
12
- if options[:sources]
13
- options[:sources].each do |type, source|
14
- concat tag(:source, src: source, type: "video/#{ type }")
15
- end
16
- end
17
-
18
- if options[:captions]
19
- options[:captions].each do |lang, caption|
20
- if caption.is_a?(Hash)
21
- caption_src = caption[:src]
22
- caption_label = caption[:label]
23
- else
24
- caption_src = caption
25
- end
26
-
27
- concat tag(:track, kind: :captions, src: caption_src, srclang: lang, label: caption_label, default: (options[:default_caption_language].present? && options[:default_caption_language].to_sym == lang.to_sym))
28
- end
29
- end
30
-
31
- concat content_tag(:p, class: 'vjs-no-js') { yield }
32
- end
33
- %>