Skip to content

Commit

Permalink
fix: Edge shown two captions
Browse files Browse the repository at this point in the history
  • Loading branch information
raccoon-lee committed Dec 6, 2018
1 parent 6b23659 commit 790509c
Show file tree
Hide file tree
Showing 18 changed files with 1,243 additions and 33 deletions.
2 changes: 1 addition & 1 deletion demo/dist/demo.css

Large diffs are not rendered by default.

40 changes: 23 additions & 17 deletions demo/dist/demo.js

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

2 changes: 1 addition & 1 deletion demo/dist/demo.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/dist/demo.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demo/dist/demo.min.js.map

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions dist/plyr.js

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

2 changes: 1 addition & 1 deletion dist/plyr.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plyr.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plyr.min.js.map

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions dist/plyr.polyfilled.js

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

2 changes: 1 addition & 1 deletion dist/plyr.polyfilled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plyr.polyfilled.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plyr.polyfilled.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hahow-plyr",
"version": "1.3.5",
"version": "1.3.7",
"description":
"A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "https://plyr.io",
Expand Down
4 changes: 3 additions & 1 deletion src/js/captions.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ const captions = {
if (this.captions.currentTrack !== index) {
this.captions.currentTrack = index;
const track = tracks[index];
track.mode = 'showing';
if(!browser.isEdge){
track.mode = 'showing';
}
const { language } = track || {};

// Store reference to node for invalidation on remove
Expand Down
6 changes: 6 additions & 0 deletions src/js/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import support from './support';
import ui from './ui';
import { createElement, insertElement, removeElement, setAttributes } from './utils/elements';
import is from './utils/is';
import browser from './utils/browser';
import { getDeep } from './utils/objects';

const source = {
Expand Down Expand Up @@ -149,6 +150,11 @@ const source = {
if (defaultTracks.length > 0 ){
defaultCaption = defaultTracks[0].srclang;
}
if(this.media.textTracks && browser.isEdge){
for(var i = 0; i< this.media.textTracks.length; i++){
this.media.textTracks[i].mode = 'hidden';
}
}
captions.update.call(this);
}

Expand Down
1 change: 1 addition & 0 deletions src/js/utils/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const browser = {
isWebkit: 'WebkitAppearance' in document.documentElement.style && !/Edge/.test(navigator.userAgent),
isIPhone: /(iPhone|iPod)/gi.test(navigator.platform),
isIos: /(iPad|iPhone|iPod)/gi.test(navigator.platform),
isEdge: /Edge\/\d./i.test(navigator.userAgent),
};

export default browser;
Loading

0 comments on commit 790509c

Please sign in to comment.