Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4196

camera component not stopping streams when detaching

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.1
    • 8.6.0.1
    • Components
    • Security Level: Jimmy
    • ZK 8.6.1 S1

      Steps to Reproduce

      start a camera component (requestCamera) camera-stop.zul
      detach the component (click the 'detach' button)

      Current Result

      the camera light (indicating recording) remains activated

      Expected Result

      the camera should stop streaming when the component is detached

      Root Cause

      the individual tracks (audio/video) inside the stream object (video.srcObject) keep running and need to be stopped individually

      Workaround

      zk.afterLoad('zkmax.med', function() {
      	var xCamera = {};
      	zk.override(zkmax.med.Camera.prototype, xCamera, {
      		unbind_: function() {
      			var video = this.$n('real');
      			var stream = video.srcObject;
      			if(stream) {
      				stream.getTracks().forEach(function(track) {
      					track.stop();
      				});
      				video.srcObject = null;
      			}
      			xCamera.unbind_.apply(this, arguments);
      		}
      	});//zk.override
      });//zk.afterLoad
      

            CharlesQiu CharlesQiu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - 3 hours Remaining Estimate - 1 hour
                3h