videojs_rails 4.12.14 → 4.12.15

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: bd34c01c47f8f64b5a861de2989f953edb3e25e7
4
- data.tar.gz: 90aa8d52c51fd060280dc1f6c564d7103a0b07bd
3
+ metadata.gz: a4bace1ee88ca2b58be1fa239cf90e397db30376
4
+ data.tar.gz: d1368fa459853c9349577f31ef5230815bf7329c
5
5
  SHA512:
6
- metadata.gz: 901dcfb2c667406f6c4c7a1ea312a7980ee4bec6d86db5226c76a265d1b83d858802c03d5cc9f1b06db8d864fb45261317f531fce9f14060f420ba63af5aa296
7
- data.tar.gz: 6d76ee49a2f05621e443c18e76d11f8e94506acd8ea255393ec65b0c4cd3ae9a19ab135a3e8d23442060b2c6df77f2ce4c8ca2fc8393e29139111f9523e29aa4
6
+ metadata.gz: 18223a3310e310112df9fe1624eed4514bc70c0342f472a21ccb86803ccb399c700fc7bec7d94f19f8d962f277d9a2199fc716f3ea41e62d37ea2d828885d30b
7
+ data.tar.gz: db4e99e053818a473c592919ced475c30be9c86992dbc6d2ea7d627c305a01e45378a91d0128fc1a396c5eac98dd8b0505a39c7be6302aa8190c981f4f5aad6b
@@ -1,2 +1,3 @@
1
+ require 'videojs_rails/tags'
1
2
  require 'videojs_rails/railtie'
2
3
  require 'videojs_rails/engine' if defined?(Rails && Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR >=1)
@@ -0,0 +1,9 @@
1
+ require 'videojs_rails/tags/tag'
2
+ require 'videojs_rails/tags/video'
3
+ require 'videojs_rails/tags/caption'
4
+ require 'videojs_rails/tags/source'
5
+
6
+ module VideojsRails
7
+ module Tags
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ module VideojsRails
2
+ module Tags
3
+ class Caption < Tag
4
+ def initialize(lang, default_language, options)
5
+ @lang = lang.to_sym
6
+ @default_language = default_language
7
+ parse_options(options)
8
+ end
9
+
10
+ def to_html
11
+ tag :track, attributes
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :src, :label, :lang, :default_language
17
+
18
+ def default?
19
+ default_language == lang
20
+ end
21
+
22
+ def parse_options(options)
23
+ case options
24
+ when String, Symbol
25
+ @src = options
26
+ when Hash
27
+ @src, @label = options.values_at(:src, :label)
28
+ else
29
+ raise ArgumentError
30
+ end
31
+ end
32
+
33
+ def attributes
34
+ {
35
+ kind: :captions,
36
+ src: src,
37
+ srclang: lang,
38
+ label: label,
39
+ default: default?
40
+ }
41
+ end
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,36 @@
1
+ module VideojsRails
2
+ module Tags
3
+ class Source < Tag
4
+ def initialize(video_type, options)
5
+ @video_type = video_type
6
+ @attributes = parse_options(options)
7
+ end
8
+
9
+ def to_html
10
+ tag :source, @attributes
11
+ end
12
+
13
+ private
14
+
15
+ attr_reader :video_type
16
+
17
+ def parse_options(options)
18
+ case options
19
+ when String, Symbol
20
+ {
21
+ src: options,
22
+ type: type
23
+ }
24
+ when Hash
25
+ options
26
+ else
27
+ raise ArgumentError
28
+ end
29
+ end
30
+
31
+ def type
32
+ "video/#{video_type}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,9 @@
1
+ module VideojsRails
2
+ module Tags
3
+ class Tag
4
+ include ActionView::Helpers::TagHelper
5
+ include ActionView::Context
6
+ include ActionView::Helpers::TextHelper
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,42 @@
1
+ module VideojsRails
2
+ module Tags
3
+ class Video < Tag
4
+ DEFAULT_LANGUAGE_KEY = :default_caption_language
5
+ DEFAULT_OPTIONS = {
6
+ controls: true,
7
+ preload: :auto
8
+ }.freeze
9
+
10
+ def initialize(options, &no_js)
11
+ @no_js = no_js
12
+ prepare_options(options)
13
+ end
14
+
15
+ def to_html
16
+ content_tag(:video, options) do
17
+ sources.each {|type, options| concat Source.new(type, options).to_html }
18
+ captions.each {|lang, options| concat Caption.new(lang, default_caption_language, options).to_html }
19
+ generate_no_js
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :no_js, :sources, :captions, :options, :default_caption_language
26
+
27
+ def prepare_options(user_options)
28
+ @sources = user_options.delete(:sources) || []
29
+ @captions = user_options.delete(:captions) || []
30
+ @default_caption_language = user_options.delete(DEFAULT_LANGUAGE_KEY)
31
+ @options = DEFAULT_OPTIONS.merge(user_options)
32
+ options[:'data-setup'] = options.delete(:setup) if options.key?(:setup)
33
+ options[:class] = [:'video-js', :'vjs-default-skin', *options[:class]]
34
+ end
35
+
36
+ def generate_no_js
37
+ return if no_js.nil?
38
+ concat content_tag(:p, no_js.call(), class: :'vjs-no-js')
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module VideojsRails
2
- VERSION = '4.12.14'
2
+ VERSION = '4.12.15'
3
3
  end
@@ -1,72 +1,7 @@
1
1
  module VideojsRails
2
2
  module ViewHelpers
3
- DEFAULT_OPTIONS = {
4
- controls: true,
5
- preload: :auto
6
- }.freeze
7
-
8
3
  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
56
- }
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')
4
+ VideojsRails::Tags::Video.new(user_options, &blk).to_html
70
5
  end
71
6
  end
72
7
  end
data/readme.md CHANGED
@@ -81,7 +81,7 @@ before_change = ->
81
81
  video = videojs('example_video')
82
82
  video.dispose()
83
83
 
84
- $(document).on('page:before-change', before_change)
84
+ $(document).on('page:before-unload', before_change)
85
85
  $(document).on('page:change', change)
86
86
  ```
87
87
 
@@ -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.14';
83
+ vjs['VERSION'] = '4.12.15';
84
84
 
85
85
  /**
86
86
  * Global Player instance options, surfaced from vjs.Player.prototype.options_
@@ -7882,6 +7882,10 @@ vjs.Flash.prototype.dispose = function(){
7882
7882
  };
7883
7883
 
7884
7884
  vjs.Flash.prototype.play = function(){
7885
+ if (this.ended()) {
7886
+ this['setCurrentTime'](0);
7887
+ }
7888
+
7885
7889
  this.el_.vjs_play();
7886
7890
  };
7887
7891
 
@@ -9896,7 +9900,7 @@ vjs.plugin = function(name, init){
9896
9900
  vjs.Player.prototype[name] = init;
9897
9901
  };
9898
9902
 
9899
- /* vtt.js - v0.11.11 (https://github.com/mozilla/vtt.js) built on 22-01-2015 */
9903
+ /* vtt.js - v0.12.1 (https://github.com/mozilla/vtt.js) built on 08-07-2015 */
9900
9904
 
9901
9905
  (function(root) {
9902
9906
  var vttjs = root.vttjs = {};
@@ -10246,7 +10250,7 @@ vjs.plugin = function(name, init){
10246
10250
 
10247
10251
  var scrollSetting = {
10248
10252
  "": true,
10249
- "up": true,
10253
+ "up": true
10250
10254
  };
10251
10255
 
10252
10256
  function findScrollSetting(value) {
@@ -11162,7 +11166,7 @@ vjs.plugin = function(name, init){
11162
11166
  if (cue.vertical === "") {
11163
11167
  this.applyStyles({
11164
11168
  left: this.formatStyle(textPos, "%"),
11165
- width: this.formatStyle(cue.size, "%"),
11169
+ width: this.formatStyle(cue.size, "%")
11166
11170
  });
11167
11171
  // Vertical box orientation; textPos is the distance from the top edge of the
11168
11172
  // area to the top edge of the box and cue.size is the height extending
@@ -11181,7 +11185,7 @@ vjs.plugin = function(name, init){
11181
11185
  left: this.formatStyle(box.left, "px"),
11182
11186
  right: this.formatStyle(box.right, "px"),
11183
11187
  height: this.formatStyle(box.height, "px"),
11184
- width: this.formatStyle(box.width, "px"),
11188
+ width: this.formatStyle(box.width, "px")
11185
11189
  });
11186
11190
  };
11187
11191
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  Video.js Default Styles (http://videojs.com)
3
- Version 4.12.14
3
+ Version 4.12.15
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.14
4
+ version: 4.12.15
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-08-30 00:00:00.000000000 Z
11
+ date: 2016-04-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: HTML5 VideoJS plugin
14
14
  email:
@@ -23,6 +23,11 @@ files:
23
23
  - lib/videojs_rails.rb
24
24
  - lib/videojs_rails/engine.rb
25
25
  - lib/videojs_rails/railtie.rb
26
+ - lib/videojs_rails/tags.rb
27
+ - lib/videojs_rails/tags/caption.rb
28
+ - lib/videojs_rails/tags/source.rb
29
+ - lib/videojs_rails/tags/tag.rb
30
+ - lib/videojs_rails/tags/video.rb
26
31
  - lib/videojs_rails/version.rb
27
32
  - lib/videojs_rails/view_helpers.rb
28
33
  - readme.md
@@ -54,8 +59,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
59
  version: '0'
55
60
  requirements: []
56
61
  rubyforge_project: videojs_rails
57
- rubygems_version: 2.4.5
62
+ rubygems_version: 2.2.5
58
63
  signing_key:
59
64
  specification_version: 4
60
65
  summary: VideoJS plugin for Rails 3.1 Asset Pipeline
61
66
  test_files: []
67
+ has_rdoc: