commit 7d63074c9944ebd4821e933f58c50feff892df85
parent ba8c40a5afdbba28544ca4e3bc390415eb69970d
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 18 Jul 2015 03:35:49 +0200
Destroy stream and video prior closing the webcam dialog
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/WebcamPanel.js b/src/PartKeepr/FrontendBundle/Resources/public/js/Components/Widgets/WebcamPanel.js
@@ -24,6 +24,7 @@ Ext.define('PartKeepr.WebcamPanel', {
}
}],
video: null,
+ stream: null,
initComponent: function ()
{
@@ -44,8 +45,10 @@ Ext.define('PartKeepr.WebcamPanel', {
this.callParent();
this.on("afterrender", this._onAfterRender, this);
+ this.on("beforedestroy", this._onBeforeDestroy, this);
},
handleVideo: function (stream) {
+ this.stream = stream;
this.video.src = window.URL.createObjectURL(stream);
},
videoError: function () {
@@ -89,5 +92,11 @@ Ext.define('PartKeepr.WebcamPanel', {
this.takePhotoButton.disable();
this.takePhotoButton.setText(i18n("Uploading..."));
+ },
+ _onBeforeDestroy: function () {
+ this.stream.stop();
+ this.video.pause();
+ this.video.src=null;
}
+
});
\ No newline at end of file