Skip to content

Commit e2f0ee3

Browse files
committed
fix: pause video on destroy
1 parent 6cc4d7f commit e2f0ee3

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
2929
"prepush": "npm run lint",
3030
"commitmsg": "node config/validate-commit-msg.js",
31-
"changelog": "node config/changelog.js"
31+
"changelog": "node config/changelog.js",
32+
"packages": "npm run packages:update && npm run packages:build && npm run packages:publish",
33+
"packages:update": "pvu --update=react-view360,ngx-view360/projects/ngx-view360,vue-view360",
34+
"packages:build": "pvu --build=react-view360,ngx-view360,vue-view360",
35+
"packages:publish": "pvu --publish=react-view360,ngx-view360/dist/ngx-view360,vue-view360"
3236
},
3337
"repository": {
3438
"type": "git",

src/PanoViewer/PanoViewer.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -473,13 +473,14 @@ class PanoViewer extends Component<PanoViewerEvent> {
473473
}
474474

475475
if (image) {
476+
this._deactivate();
477+
476478
this._image = image as HTMLImageElement;
477479
this._isVideo = isVideo;
478480
this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;
479481
this._cubemapConfig = cubemapConfig;
480482
this._stereoFormat = stereoFormat;
481483

482-
this._deactivate();
483484
this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);
484485
}
485486

@@ -990,6 +991,12 @@ class PanoViewer extends Component<PanoViewerEvent> {
990991
* Destroy webgl context and block user interaction and stop rendering
991992
*/
992993
private _deactivate() {
994+
// Turn off the video if it has one
995+
const video = this.getVideo();
996+
if (video) {
997+
video.pause();
998+
}
999+
9931000
if (this._isReady) {
9941001
this._photoSphereRenderer!.stopRender();
9951002
this._yawPitchControl!.disable();

0 commit comments

Comments
 (0)