Skip to content

Commit

Permalink
v0.1.8
Browse files Browse the repository at this point in the history
fix "can not removeEventListener _orientationchangeEvt";
fix playbutton's direction abnormal when disableRotation config true;
  • Loading branch information
cycjimmy committed Oct 31, 2017
1 parent 8ab48d4 commit e86abb6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 29 deletions.
26 changes: 10 additions & 16 deletions dist/H5VideoPlayer.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/H5VideoPlayer.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": "h5-video-player",
"version": "0.1.7",
"version": "0.1.8",
"description": "Browser full screen H5 video player",
"main": "build/H5VideoPlayer.js",
"scripts": {
Expand Down
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,16 @@ export default class H5VideoPlayer {
orientation: this.options.orientation,
_style,
});
this.container.appendChild(this.wrapper);

// video
this.videoWrapperForConstraintRatio = this.wrapper.querySelector('.' + _style.videoWrapperForConstraintRatio);
this.video = this.wrapper.querySelector('.' + _style.video);

// mask: used to control video
this.mask = this.wrapper.querySelector('.' + _style.mask);
this.mask = document.createElement('div');
this.mask.classList.add(_style.mask);
this.container.appendChild(this.mask);

// playButton
if (this.options.control) {
Expand All @@ -110,10 +113,8 @@ export default class H5VideoPlayer {
});
}

this.wrapper.appendChild(this.playButton);
this.container.appendChild(this.playButton);
}

this.container.appendChild(this.wrapper);
};

init() {
Expand Down Expand Up @@ -251,19 +252,18 @@ export default class H5VideoPlayer {
}

, _changeOrientation = () => {
window.removeEventListener(_orientationchangeEvt, () => _changeOrientation());
window.removeEventListener(_orientationchangeEvt, _changeOrientation);

setTimeout(() => {
_changeStyle();
window.addEventListener(_orientationchangeEvt, () => _changeOrientation(), false);
}, 500);
window.addEventListener(_orientationchangeEvt, _changeOrientation, false);
}, 400);
}
;

if (this.options.disableRotation) {
_changeStyle();

window.addEventListener(_orientationchangeEvt, () => _changeOrientation(), false);
window.addEventListener(_orientationchangeEvt, _changeOrientation, false);

} else {
_addStyles(this.wrapper, {
Expand Down
2 changes: 0 additions & 2 deletions src/wrapper.pug
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@ div(class=_style.videoWrapperForConstraintRatio)
source(src=source)

| I'm sorry; your browser doesn't support HTML5 video.

div(class=_style.mask)
1 change: 1 addition & 0 deletions static/view/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ html(lang='en')
var video = new H5VideoPlayer(source, {
context: '#videoWrapper',
control: true,
disableRotation: true,
hookInPlay: function () {
console.log('hookInPlay');
},
Expand Down

0 comments on commit e86abb6

Please sign in to comment.