videojs_rails 4.8.5 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd3726f0bcb50d96a549cd38708be1bb4b3d0e38
4
- data.tar.gz: 2b455501a0e722edfea7674eabfadbb60943ca6e
3
+ metadata.gz: dd83ed4ae38c370b448785bff4dfabccc489277c
4
+ data.tar.gz: 67eb6cadd49fe9623c20c6bf9a6e9fc1ba1a7802
5
5
  SHA512:
6
- metadata.gz: d0bc45fb6f8af378b09346432560df7a7b6745a77037740b47734153e23f65f5db3e8d877430a93fb07115e635829554c73f7e71d2501f65671c8e863b8e46ba
7
- data.tar.gz: 7175ddcba6b9c779f21628e907f5f918e698c3ea8ceb92d0e6d0ca68fe71efa04face1c91b50291448d4179664036e550ba703ced671a5102f7a50aa529941b1
6
+ metadata.gz: ae07acbaeda8ac7e420b761b4b79126eae148cb3964bd5b985a24af34f9799a545d6203add474aa2dddb5d4e0a9c1e5651072117ef9ba583a195fc295b8984e5
7
+ data.tar.gz: 53d5a6b2a2fec3ce534ce0f9dc7cd24c3f2268bd0a7049c046d68add803f02401be1128f4005c925afc42f4314bb66a4537b7648407ac7da913847abe5a2cbb4
@@ -1,3 +1,3 @@
1
1
  module VideojsRails
2
- VERSION = '4.8.5'
2
+ VERSION = '4.9.0'
3
3
  end
@@ -63,7 +63,7 @@ var vjs = function(id, options, ready){
63
63
  var videojs = window['videojs'] = vjs;
64
64
 
65
65
  // CDN Version. Used to target right flash swf.
66
- vjs.CDN_VERSION = '4.8';
66
+ vjs.CDN_VERSION = '4.9';
67
67
  vjs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');
68
68
 
69
69
  /**
@@ -116,7 +116,7 @@ vjs.options = {
116
116
  };
117
117
 
118
118
  // Set CDN Version of swf
119
- // The added (+) blocks the replace from changing this 4.8 string
119
+ // The added (+) blocks the replace from changing this 4.9 string
120
120
  if (vjs.CDN_VERSION !== 'GENERATED'+'_CDN_VSN') {
121
121
  videojs.options['flash']['swf'] = "<%= asset_path('video-js.swf') %>";
122
122
  }
@@ -972,6 +972,17 @@ vjs.isEmpty = function(obj) {
972
972
  return true;
973
973
  };
974
974
 
975
+ /**
976
+ * Check if an element has a CSS class
977
+ * @param {Element} element Element to check
978
+ * @param {String} classToCheck Classname to check
979
+ * @private
980
+ */
981
+ vjs.hasClass = function(element, classToCheck){
982
+ return ((' ' + element.className + ' ').indexOf(' ' + classToCheck + ' ') !== -1);
983
+ };
984
+
985
+
975
986
  /**
976
987
  * Add a CSS class name to an element
977
988
  * @param {Element} element Element to add class name to
@@ -979,7 +990,7 @@ vjs.isEmpty = function(obj) {
979
990
  * @private
980
991
  */
981
992
  vjs.addClass = function(element, classToAdd){
982
- if ((' '+element.className+' ').indexOf(' '+classToAdd+' ') == -1) {
993
+ if (!vjs.hasClass(element, classToAdd)) {
983
994
  element.className = element.className === '' ? classToAdd : element.className + ' ' + classToAdd;
984
995
  }
985
996
  };
@@ -993,7 +1004,7 @@ vjs.addClass = function(element, classToAdd){
993
1004
  vjs.removeClass = function(element, classToRemove){
994
1005
  var classNames, i;
995
1006
 
996
- if (element.className.indexOf(classToRemove) == -1) { return; }
1007
+ if (!vjs.hasClass(element, classToRemove)) {return;}
997
1008
 
998
1009
  classNames = element.className.split(' ');
999
1010
 
@@ -2267,6 +2278,16 @@ vjs.Component.prototype.triggerReady = function(){
2267
2278
  /* Display
2268
2279
  ============================================================================= */
2269
2280
 
2281
+ /**
2282
+ * Check if a component's element has a CSS class name
2283
+ *
2284
+ * @param {String} classToCheck Classname to check
2285
+ * @return {vjs.Component}
2286
+ */
2287
+ vjs.Component.prototype.hasClass = function(classToCheck){
2288
+ return vjs.hasClass(this.el_, classToCheck);
2289
+ };
2290
+
2270
2291
  /**
2271
2292
  * Add a CSS class name to the component's element
2272
2293
  *
@@ -2713,6 +2734,17 @@ vjs.Slider = vjs.Component.extend({
2713
2734
  }
2714
2735
  });
2715
2736
 
2737
+ vjs.Slider.prototype.dispose = function() {
2738
+ vjs.off(document, 'mousemove', this.boundEvents.move, false);
2739
+ vjs.off(document, 'mouseup', this.boundEvents.end, false);
2740
+ vjs.off(document, 'touchmove', this.boundEvents.move, false);
2741
+ vjs.off(document, 'touchend', this.boundEvents.end, false);
2742
+
2743
+ vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
2744
+
2745
+ vjs.Component.prototype.dispose.call(this);
2746
+ };
2747
+
2716
2748
  vjs.Slider.prototype.createEl = function(type, props) {
2717
2749
  props = props || {};
2718
2750
  // Add the slider element class to all sub classes
@@ -3128,7 +3160,6 @@ vjs.MenuButton.prototype.unpressButton = function(){
3128
3160
  this.menu.unlockShowing();
3129
3161
  this.el_.setAttribute('aria-pressed', false);
3130
3162
  };
3131
-
3132
3163
  /**
3133
3164
  * Custom MediaError to mimic the HTML5 MediaError
3134
3165
  * @param {Number} code The media error code
@@ -3349,6 +3380,9 @@ vjs.Player = vjs.Component.extend({
3349
3380
  // see enableTouchActivity in Component
3350
3381
  options.reportTouchActivity = false;
3351
3382
 
3383
+ // Set isAudio based on whether or not an audio tag was used
3384
+ this.isAudio(this.tag.nodeName.toLowerCase() === 'audio');
3385
+
3352
3386
  // Run base component initializing with new options.
3353
3387
  // Builds the element through createEl()
3354
3388
  // Inits and embeds any child components in opts
@@ -3362,6 +3396,10 @@ vjs.Player = vjs.Component.extend({
3362
3396
  this.addClass('vjs-controls-disabled');
3363
3397
  }
3364
3398
 
3399
+ if (this.isAudio()) {
3400
+ this.addClass('vjs-audio');
3401
+ }
3402
+
3365
3403
  // TODO: Make this smarter. Toggle user state between touching/mousing
3366
3404
  // using events, since devices can have both touch and mouse events.
3367
3405
  // if (vjs.TOUCH_ENABLED) {
@@ -3452,12 +3490,24 @@ vjs.Player.prototype.dispose = function(){
3452
3490
  };
3453
3491
 
3454
3492
  vjs.Player.prototype.getTagSettings = function(tag){
3455
- var options = {
3456
- 'sources': [],
3457
- 'tracks': []
3458
- };
3493
+ var tagOptions,
3494
+ dataSetup,
3495
+ options = {
3496
+ 'sources': [],
3497
+ 'tracks': []
3498
+ };
3499
+
3500
+ tagOptions = vjs.getElementAttributes(tag);
3501
+ dataSetup = tagOptions['data-setup'];
3459
3502
 
3460
- vjs.obj.merge(options, vjs.getElementAttributes(tag));
3503
+ // Check if data-setup attr exists.
3504
+ if (dataSetup !== null){
3505
+ // Parse options JSON
3506
+ // If empty string, make it a parsable json object.
3507
+ vjs.obj.merge(tagOptions, vjs.JSON.parse(dataSetup || '{}'));
3508
+ }
3509
+
3510
+ vjs.obj.merge(options, tagOptions);
3461
3511
 
3462
3512
  // Get tag children settings
3463
3513
  if (tag.hasChildNodes()) {
@@ -3517,7 +3567,13 @@ vjs.Player.prototype.createEl = function(){
3517
3567
  // ID will now reference player box, not the video tag
3518
3568
  attrs = vjs.getElementAttributes(tag);
3519
3569
  vjs.obj.each(attrs, function(attr) {
3520
- el.setAttribute(attr, attrs[attr]);
3570
+ // workaround so we don't totally break IE7
3571
+ // http://stackoverflow.com/questions/3653444/css-styles-not-applied-on-dynamic-elements-in-internet-explorer-7
3572
+ if (attr == 'class') {
3573
+ el.className = attrs[attr];
3574
+ } else {
3575
+ el.setAttribute(attr, attrs[attr]);
3576
+ }
3521
3577
  });
3522
3578
 
3523
3579
  // Update tag id/class for use as HTML5 playback tech
@@ -3768,7 +3824,7 @@ vjs.Player.prototype.onPause = function(){
3768
3824
  /**
3769
3825
  * Fired when the current playback position has changed
3770
3826
  *
3771
- * During playback this is fired every 15-250 milliseconds, depnding on the
3827
+ * During playback this is fired every 15-250 milliseconds, depending on the
3772
3828
  * playback technology in use.
3773
3829
  * @event timeupdate
3774
3830
  */
@@ -4549,6 +4605,8 @@ vjs.Player.prototype.poster = function(src){
4549
4605
 
4550
4606
  // alert components that the poster has been set
4551
4607
  this.trigger('posterchange');
4608
+
4609
+ return this;
4552
4610
  };
4553
4611
 
4554
4612
  /**
@@ -4831,6 +4889,16 @@ vjs.Player.prototype.playbackRate = function(rate) {
4831
4889
 
4832
4890
  };
4833
4891
 
4892
+ vjs.Player.prototype.isAudio_ = false;
4893
+ vjs.Player.prototype.isAudio = function(bool) {
4894
+ if (bool !== undefined) {
4895
+ this.isAudio_ = !!bool;
4896
+ return this;
4897
+ }
4898
+
4899
+ return this.isAudio_;
4900
+ };
4901
+
4834
4902
  // Methods to add support for
4835
4903
  // networkState: function(){ return this.techCall('networkState'); },
4836
4904
  // readyState: function(){ return this.techCall('readyState'); },
@@ -5594,6 +5662,12 @@ vjs.VolumeMenuButton.prototype.createMenu = function(){
5594
5662
  contentElType: 'div'
5595
5663
  });
5596
5664
  var vc = new vjs.VolumeBar(this.player_, vjs.obj.merge({'vertical': true}, this.options_.volumeBar));
5665
+ vc.on('focus', function() {
5666
+ menu.lockShowing();
5667
+ });
5668
+ vc.on('blur', function() {
5669
+ menu.unlockShowing();
5670
+ });
5597
5671
  menu.addChild(vc);
5598
5672
  return menu;
5599
5673
  };
@@ -5765,7 +5839,9 @@ vjs.PosterImage = vjs.Button.extend({
5765
5839
  this.src(player.poster());
5766
5840
  }));
5767
5841
 
5768
- player.on('play', vjs.bind(this, this.hide));
5842
+ if (!player.isAudio()) {
5843
+ player.on('play', vjs.bind(this, this.hide));
5844
+ }
5769
5845
  }
5770
5846
  });
5771
5847
 
@@ -7216,8 +7292,6 @@ vjs.TextTrack = vjs.Component.extend({
7216
7292
  this.activeCues_ = [];
7217
7293
  this.readyState_ = 0;
7218
7294
  this.mode_ = 0;
7219
-
7220
- this.player_.on('fullscreenchange', vjs.bind(this, this.adjustFontSize));
7221
7295
  }
7222
7296
  });
7223
7297
 
@@ -7375,22 +7449,6 @@ vjs.TextTrack.prototype.mode = function(){
7375
7449
  return this.mode_;
7376
7450
  };
7377
7451
 
7378
- /**
7379
- * Change the font size of the text track to make it larger when playing in fullscreen mode
7380
- * and restore it to its normal size when not in fullscreen mode.
7381
- */
7382
- vjs.TextTrack.prototype.adjustFontSize = function(){
7383
- if (this.player_.isFullscreen()) {
7384
- // Scale the font by the same factor as increasing the video width to the full screen window width.
7385
- // Additionally, multiply that factor by 1.4, which is the default font size for
7386
- // the caption track (from the CSS)
7387
- this.el_.style.fontSize = screen.width / this.player_.width() * 1.4 * 100 + '%';
7388
- } else {
7389
- // Change the font size of the text track back to its original non-fullscreen size
7390
- this.el_.style.fontSize = '';
7391
- }
7392
- };
7393
-
7394
7452
  /**
7395
7453
  * Create basic div to hold cue text
7396
7454
  * @return {Element}
@@ -8185,33 +8243,48 @@ if (typeof window.JSON !== 'undefined' && window.JSON.parse === 'function') {
8185
8243
 
8186
8244
  // Automatically set up any tags that have a data-setup attribute
8187
8245
  vjs.autoSetup = function(){
8188
- var options, vid, player,
8189
- vids = document.getElementsByTagName('video');
8246
+ var options, mediaEl, player, i, e;
8247
+
8248
+ // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*
8249
+ // var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));
8250
+ // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));
8251
+ // var mediaEls = vids.concat(audios);
8252
+
8253
+ // Because IE8 doesn't support calling slice on a node list, we need to loop through each list of elements
8254
+ // to build up a new, combined list of elements.
8255
+ var vids = document.getElementsByTagName('video');
8256
+ var audios = document.getElementsByTagName('audio');
8257
+ var mediaEls = [];
8258
+ if (vids && vids.length > 0) {
8259
+ for(i=0, e=vids.length; i<e; i++) {
8260
+ mediaEls.push(vids[i]);
8261
+ }
8262
+ }
8263
+ if (audios && audios.length > 0) {
8264
+ for(i=0, e=audios.length; i<e; i++) {
8265
+ mediaEls.push(audios[i]);
8266
+ }
8267
+ }
8190
8268
 
8191
8269
  // Check if any media elements exist
8192
- if (vids && vids.length > 0) {
8270
+ if (mediaEls && mediaEls.length > 0) {
8193
8271
 
8194
- for (var i=0,j=vids.length; i<j; i++) {
8195
- vid = vids[i];
8272
+ for (i=0,e=mediaEls.length; i<e; i++) {
8273
+ mediaEl = mediaEls[i];
8196
8274
 
8197
8275
  // Check if element exists, has getAttribute func.
8198
8276
  // IE seems to consider typeof el.getAttribute == 'object' instead of 'function' like expected, at least when loading the player immediately.
8199
- if (vid && vid.getAttribute) {
8277
+ if (mediaEl && mediaEl.getAttribute) {
8200
8278
 
8201
8279
  // Make sure this player hasn't already been set up.
8202
- if (vid['player'] === undefined) {
8203
- options = vid.getAttribute('data-setup');
8280
+ if (mediaEl['player'] === undefined) {
8281
+ options = mediaEl.getAttribute('data-setup');
8204
8282
 
8205
8283
  // Check if data-setup attr exists.
8206
8284
  // We only auto-setup if they've added the data-setup attr.
8207
8285
  if (options !== null) {
8208
-
8209
- // Parse options JSON
8210
- // If empty string, make it a parsable json object.
8211
- options = vjs.JSON.parse(options || '{}');
8212
-
8213
8286
  // Create new video.js instance.
8214
- player = videojs(vid, options);
8287
+ player = videojs(mediaEl);
8215
8288
  }
8216
8289
  }
8217
8290
 
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  Video.js Default Styles (http://videojs.com)
3
- Version 4.8.5
3
+ Version 4.9.0
4
4
  Create your own skin at http://designer.videojs.com
5
5
  */
6
6
  /* SKIN
@@ -123,6 +123,11 @@ The default control bar that is a container for most of the controls.
123
123
  .vjs-default-skin.vjs-error .vjs-control-bar {
124
124
  display: none;
125
125
  }
126
+ /* Don't hide the control bar if it's audio */
127
+ .vjs-audio.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar {
128
+ opacity: 1;
129
+ visibility: visible;
130
+ }
126
131
  /* IE8 is flakey with fonts, and you have to change the actual content to force
127
132
  fonts to show/hide properly.
128
133
  - "\9" IE8 hack didn't work for this
@@ -144,7 +149,7 @@ fonts to show/hide properly.
144
149
  height: 3.0em;
145
150
  width: 4em;
146
151
  }
147
- /* FontAwsome button icons */
152
+ /* Font button icons */
148
153
  .vjs-default-skin .vjs-control:before {
149
154
  font-family: VideoJS;
150
155
  font-size: 1.5em;
@@ -244,9 +249,6 @@ fonts to show/hide properly.
244
249
  height: 0.6em;
245
250
  margin: 1.1em auto 0;
246
251
  }
247
- .vjs-default-skin .vjs-volume-menu-button .vjs-menu-content {
248
- height: 2.9em;
249
- }
250
252
  .vjs-default-skin .vjs-volume-level {
251
253
  position: absolute;
252
254
  top: 0;
@@ -273,9 +275,31 @@ fonts to show/hide properly.
273
275
  width: 1em;
274
276
  height: 1em;
275
277
  }
278
+ /* The volume menu button is like menu buttons (captions/subtitles) but works
279
+ a little differently. It needs to be possible to tab to the volume slider
280
+ without hitting space bar on the menu button. To do this we're not using
281
+ display:none to hide the slider menu by default, and instead setting the
282
+ width and height to zero. */
283
+ .vjs-default-skin .vjs-volume-menu-button .vjs-menu {
284
+ display: block;
285
+ width: 0;
286
+ height: 0;
287
+ border-top-color: transparent;
288
+ }
276
289
  .vjs-default-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content {
277
- width: 6em;
278
- left: -4em;
290
+ height: 0;
291
+ width: 0;
292
+ }
293
+ .vjs-default-skin .vjs-volume-menu-button:hover .vjs-menu,
294
+ .vjs-default-skin .vjs-volume-menu-button .vjs-menu.vjs-lock-showing {
295
+ border-top-color: rgba(7, 40, 50, 0.5);
296
+ /* Same as ul background */
297
+
298
+ }
299
+ .vjs-default-skin .vjs-volume-menu-button:hover .vjs-menu .vjs-menu-content,
300
+ .vjs-default-skin .vjs-volume-menu-button .vjs-menu.vjs-lock-showing .vjs-menu-content {
301
+ height: 2.9em;
302
+ width: 10em;
279
303
  }
280
304
  /* Progress
281
305
  --------------------------------------------------------------------------------
@@ -686,7 +710,8 @@ easily in the skin designer. http://designer.videojs.com/
686
710
  -moz-box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
687
711
  box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
688
712
  }
689
- .vjs-default-skin .vjs-menu-button:hover .vjs-menu {
713
+ .vjs-default-skin .vjs-menu-button:hover .vjs-control-content .vjs-menu,
714
+ .vjs-default-skin .vjs-control-content .vjs-menu.vjs-lock-showing {
690
715
  display: block;
691
716
  }
692
717
  .vjs-default-skin .vjs-menu-button ul li {
@@ -893,6 +918,10 @@ body.vjs-full-window {
893
918
  .vjs-tt-cue {
894
919
  display: block;
895
920
  }
921
+ /* Increase font-size when fullscreen */
922
+ .video-js.vjs-fullscreen .vjs-text-track {
923
+ font-size: 3em;
924
+ }
896
925
  /* Hide disabled or unsupported controls */
897
926
  .vjs-default-skin .vjs-hidden {
898
927
  display: none;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: videojs_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.8.5
4
+ version: 4.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Behan