From 124d979e44cbd1d10348f1233ce6584d5ba0c4a1 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 14 Mar 2019 15:24:44 +0100 Subject: [PATCH] Fixes issue #2514 - Zammad Webcam-Avatar-Feature broken. --- .../javascripts/app/controllers/_profile/avatar.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_profile/avatar.coffee b/app/assets/javascripts/app/controllers/_profile/avatar.coffee index 0cea28e16..ea3dcd251 100644 --- a/app/assets/javascripts/app/controllers/_profile/avatar.coffee +++ b/app/assets/javascripts/app/controllers/_profile/avatar.coffee @@ -301,7 +301,15 @@ class Camera extends App.ControllerModal # start to update the preview once its playing @video.on 'playing', @updatePreview - @video.attr 'src', window.URL.createObjectURL(stream) + # start stream + # Apparently this functionality (of creating a URL from a MediaStream) is now deprecated + # and has been removed from current versions of Chrome and Firefox as of mid/late 2018. + # See https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL for details. + # Apparently the new recommended approach is to set the srcObject property to the localStream directly: + try + @video.get(0).srcObject = stream + catch err + @video.attr 'src', window.URL.createObjectURL(stream) # start the stream @video.get(0).play()