Fix video dimensions after resizing #17

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer 2020-05-14 08:40:43 +02:00
parent 7c59cdc9e7
commit 22bd546c70
2 changed files with 6 additions and 5 deletions

View file

@ -71,8 +71,9 @@
shimScriptAccess: 'always', shimScriptAccess: 'always',
forceLive: false, forceLive: false,
loop: false, loop: false,
stretching: false, stretching: true,
autoplay: true, autoplay: true,
setDimensions: true,
success: (mediaElement, originalNode, instance) => { success: (mediaElement, originalNode, instance) => {
instance.setSrc(self.source); instance.setSrc(self.source);
this.success(mediaElement, originalNode, instance); this.success(mediaElement, originalNode, instance);
@ -86,8 +87,9 @@
}, },
remove() { remove() {
if (this.player) { if (this.player) {
this.player.pause();
this.player.remove(); this.player.remove();
this.player = ""; this.player = null;
} }
}, },
setSource(src) { setSource(src) {
@ -104,6 +106,8 @@
this.player.width = this.width; this.player.width = this.width;
this.player.videoHeight = this.height; this.player.videoHeight = this.height;
this.player.videoWidth = this.width; this.player.videoWidth = this.width;
this.$el.style.cssText = "width: " + this.width + "px; height: " + this.height + "px;"
this.player.setSrc(src); this.player.setSrc(src);
this.player.setPoster(""); this.player.setPoster("");
this.player.load(); this.player.load();

View file

@ -73,9 +73,6 @@
this.height = newHeight; this.height = newHeight;
} }
this.$el.style.height = this.height;
this.$el.style.width = this.width;
this.source = uri; this.source = uri;
this.show = true; this.show = true;
}, },