Skip to content

Commit

Permalink
feat: remove flash tech (#3956)
Browse files Browse the repository at this point in the history
Remove Flash Tech from core. Use videojs-flash if flash is needed.
Also, update DOM method names.

BREAKING CHANGE: remove flash tech from core.
  • Loading branch information
brandonocasey authored and gkatsev committed Jan 19, 2017
1 parent 524f868 commit b387437
Show file tree
Hide file tree
Showing 22 changed files with 297 additions and 1,882 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"tsml": "1.0.1",
"videojs-font": "2.0.0",
"videojs-ie8": "1.1.2",
"videojs-swf": "5.1.0",
"videojs-vtt.js": "0.12.1",
"xhr": "2.2.2"
},
Expand Down
11 changes: 6 additions & 5 deletions src/js/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import window from 'global/window';
import * as Dom from './utils/dom.js';
import * as DomData from './utils/dom-data';
import * as Fn from './utils/fn.js';
import * as Guid from './utils/guid.js';
import * as Events from './utils/events.js';
Expand Down Expand Up @@ -141,7 +142,7 @@ class Component {
this.el_.parentNode.removeChild(this.el_);
}

Dom.removeElData(this.el_);
DomData.removeData(this.el_);
this.el_ = null;
}

Expand Down Expand Up @@ -816,7 +817,7 @@ class Component {
* - False if the `Component` does not have the class`
*/
hasClass(classToCheck) {
return Dom.hasElClass(this.el_, classToCheck);
return Dom.hasClass(this.el_, classToCheck);
}

/**
Expand All @@ -826,7 +827,7 @@ class Component {
* CSS class name to add
*/
addClass(classToAdd) {
Dom.addElClass(this.el_, classToAdd);
Dom.addClass(this.el_, classToAdd);
}

/**
Expand All @@ -836,7 +837,7 @@ class Component {
* CSS class name to remove
*/
removeClass(classToRemove) {
Dom.removeElClass(this.el_, classToRemove);
Dom.removeClass(this.el_, classToRemove);
}

/**
Expand All @@ -851,7 +852,7 @@ class Component {
* An {@link Dom~predicate} function or a boolean
*/
toggleClass(classToToggle, predicate) {
Dom.toggleElClass(this.el_, classToToggle, predicate);
Dom.toggleClass(this.el_, classToToggle, predicate);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/js/control-bar/mute-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ class MuteToggle extends Button {

// TODO improve muted icon classes
for (let i = 0; i < 4; i++) {
Dom.removeElClass(this.el_, `vjs-vol-${i}`);
Dom.removeClass(this.el_, `vjs-vol-${i}`);
}
Dom.addElClass(this.el_, `vjs-vol-${level}`);
Dom.addClass(this.el_, `vjs-vol-${level}`);
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/js/menu/menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MenuButton extends ClickableComponent {
});

menu.children_.unshift(title);
Dom.insertElFirst(title, menu.contentEl());
Dom.prependTo(title, menu.contentEl());
}

this.items = this.createItems();
Expand Down
28 changes: 13 additions & 15 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {ALL as TRACK_TYPES} from './tracks/track-types';
// are always included in the video.js package. Importing the modules will
// execute them and they will register themselves with video.js.
import './tech/loader.js';
import './tech/flash.js';
import './poster-image.js';
import './tracks/text-track-display.js';
import './loading-spinner.js';
Expand Down Expand Up @@ -281,7 +280,7 @@ class Player extends Component {
let element = tag;

while (element && element.nodeType === 1) {
if (Dom.getElAttributes(element).hasOwnProperty('lang')) {
if (Dom.getAttributes(element).hasOwnProperty('lang')) {
options.language = element.getAttribute('lang');
break;
}
Expand All @@ -307,7 +306,7 @@ class Player extends Component {
this.tag = tag;

// Store the tag attributes used to restore html5 element
this.tagAttributes = tag && Dom.getElAttributes(tag);
this.tagAttributes = tag && Dom.getAttributes(tag);

// Update current language
this.language(this.options_.language);
Expand Down Expand Up @@ -487,7 +486,7 @@ class Player extends Component {

// Copy over all the attributes from the tag, including ID and class
// ID will now reference player box, not the video tag
const attrs = Dom.getElAttributes(tag);
const attrs = Dom.getAttributes(tag);

Object.getOwnPropertyNames(attrs).forEach(function(attr) {
// workaround so we don't totally break IE7
Expand Down Expand Up @@ -534,7 +533,7 @@ class Player extends Component {
for (let i = 0; i < links.length; i++) {
const linkEl = links.item(i);

Dom.addElClass(linkEl, 'vjs-hidden');
Dom.addClass(linkEl, 'vjs-hidden');
linkEl.setAttribute('hidden', 'hidden');
}

Expand All @@ -552,7 +551,7 @@ class Player extends Component {
// will work properly for other components
//
// Breaks iPhone, fixed in HTML5 setup.
Dom.insertElFirst(tag, el);
Dom.prependTo(tag, el);
this.children_.unshift(tag);

this.el_ = el;
Expand Down Expand Up @@ -893,7 +892,7 @@ class Player extends Component {
// Add the tech element in the DOM if it was not already there
// Make sure to not insert the original video element if using Html5
if (this.tech_.el().parentNode !== this.el() && (techName !== 'Html5' || !this.tag)) {
Dom.insertElFirst(this.tech_.el(), this.el());
Dom.prependTo(this.tech_.el(), this.el());
}

// Get rid of the original video tag reference after the first tech is loaded
Expand Down Expand Up @@ -1999,7 +1998,7 @@ class Player extends Component {
document.documentElement.style.overflow = 'hidden';

// Apply fullscreen styles
Dom.addElClass(document.body, 'vjs-full-window');
Dom.addClass(document.body, 'vjs-full-window');

/**
* @event Player#enterFullWindow
Expand Down Expand Up @@ -2038,7 +2037,7 @@ class Player extends Component {
document.documentElement.style.overflow = this.docOrigOverflow;

// Remove fullscreen styles
Dom.removeElClass(document.body, 'vjs-full-window');
Dom.removeClass(document.body, 'vjs-full-window');

// Resize the box, controller, and poster to original sizes
// this.positionAll();
Expand Down Expand Up @@ -3042,10 +3041,10 @@ class Player extends Component {
tracks: []
};

const tagOptions = Dom.getElAttributes(tag);
const tagOptions = Dom.getAttributes(tag);
const dataSetup = tagOptions['data-setup'];

if (Dom.hasElClass(tag, 'vjs-fluid')) {
if (Dom.hasClass(tag, 'vjs-fluid')) {
tagOptions.fluid = true;
}

Expand Down Expand Up @@ -3073,9 +3072,9 @@ class Player extends Component {
const childName = child.nodeName.toLowerCase();

if (childName === 'source') {
baseOptions.sources.push(Dom.getElAttributes(child));
baseOptions.sources.push(Dom.getAttributes(child));
} else if (childName === 'track') {
baseOptions.tracks.push(Dom.getElAttributes(child));
baseOptions.tracks.push(Dom.getAttributes(child));
}
}
}
Expand Down Expand Up @@ -3187,8 +3186,7 @@ const navigator = window.navigator;
*/
Player.prototype.options_ = {
// Default order of fallback technology
techOrder: ['html5', 'flash'],
// techOrder: ['flash','html5'],
techOrder: ['html5'],

html5: {},
flash: {},
Expand Down
199 changes: 0 additions & 199 deletions src/js/tech/flash-rtmp.js

This file was deleted.

Loading

0 comments on commit b387437

Please sign in to comment.