Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get and set global options methods #2115

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion sandbox/index.html.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

<!-- Set the location of the flash SWF -->
<script>
videojs.options.flash.swf = '../build/temp/video-js.swf';
videojs.setGlobalOptions({
flash: {
swf: '../build/temp/video-js.swf'
}
});
</script>

</head>
Expand Down
6 changes: 6 additions & 0 deletions src/js/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as Util from './util.js';
import Player from './player';
import extendsFn from './extends.js';
import plugin from './plugins.js';
import options from './options.js';

if (typeof HTMLVideoElement === 'undefined') {
document.createElement('video');
Expand All @@ -42,6 +43,11 @@ videojs.players = Player.players;

videojs.extends = extendsFn;

videojs.getGlobalOptions = () => options;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to start using fat arrows, make sure to make a note in the ES6 page on the wiki.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a note. I decided to use it here specifically because this function becomes so short as a fat arrow function.

videojs.setGlobalOptions = function(newOptions) {
Lib.util.mergeOptions(options, newOptions);
};

videojs.plugin = plugin;

// REMOVING: We probably should not include this in 5.0 thought it would make it
Expand Down