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

feat: Support an in-page embed without controls #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ An asynchronous script loader for the Brightcove Player.
- [`deliveryConfigId`](#deliveryconfigid)
- [`embedId`](#embedid)
- [`embedOptions`](#embedoptions)
- [`embedOptions.controls`](#embedoptionscontrols)
- [`embedOptions.pip`](#embedoptionspip)
- [`embedOptions.playlist`](#embedoptionsplaylist)
- [`embedOptions.responsive`](#embedoptionsresponsive)
Expand Down Expand Up @@ -379,6 +380,12 @@ The Brightcove Player [embed ID][bc-embed-id] for the player. The default value

Used to provide certain options for embed generation. These include:

##### `embedOptions.controls`
* *Type:* `boolean`
* *Default:* `true`

If `false`, the player will be created with control disabled. Supported for in-page (advanced) embeds only.

##### `embedOptions.pip`
* *Type:* `boolean`
* *Default:* `false`
Expand Down
4 changes: 3 additions & 1 deletion demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ $(function() {
deliveryConfigId: 1,
embedId: 1,
embedOptions: {
controls: 1,
pip: 1,
playlist: {
legacy: 1
Expand Down Expand Up @@ -58,7 +59,8 @@ $(function() {
playlist: $('#eo-playlist'),
responsive: $('#eo-resp'),
tagName: $('#eo-tag-name'),
unminified: $('#eo-unmin')
unminified: $('#eo-unmin'),
controls: $('#eo-controls')
};

function isObj(v) {
Expand Down
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ <h5 class="mb-0">
<input id="eo-pip" class="form-check-input" type="checkbox">
<label class="form-check-label" for="eo-pip">Picture-in-Picture</label>
</div>
<div class="form-check form-group">
<input id="eo-controls" class="form-check-input" type="checkbox" checked>
<label class="form-check-label" for="eo-controls">Controls</label>
</div>
<div class="form-group">
<label class="form-check-label" for="eo-playlist">Playlist</label>
<select id="eo-playlist" class="form-control">
Expand Down
41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/create-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ const createInPageEmbed = (params) => {
el.setAttribute(paramsToAttrs[key], value);
});

el.setAttribute('controls', 'controls');
if (!embedOptions || embedOptions.controls !== false) {
el.setAttribute('controls', 'controls');
}
el.classList.add('video-js');

return el;
Expand Down
12 changes: 12 additions & 0 deletions test/create-embed.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ QUnit.module('create-embed', function(hooks) {
}
});

QUnit.test('controls', function(assert) {
const embed = createEmbed({
refNode: this.fixture,
refNodeInsert: 'append',
embedOptions: {
controls: false
}
});

assert.notOk(embed.hasAttribute('controls'), this.fixture, 'has no controls attribute');
});

QUnit.test('pip', function(assert) {
const embed = createEmbed({
refNode: this.fixture,
Expand Down