camera component not stopping streams when detaching

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Normal
    • 8.6.1
    • Affects Version/s: 8.6.0.1
    • Component/s: Components
    • Security Level: Jimmy
    • ZK 8.6.1 S1
    • None

      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
      

            Assignee:
            CharlesQiu
            Reporter:
            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