[ 
https://issues.apache.org/jira/browse/CB-13384?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16490221#comment-16490221
 ] 

ASF GitHub Bot commented on CB-13384:
-------------------------------------

shazron closed pull request #288: CB-13384: (browser) Added deprecation of 
video.src compatibility
URL: https://github.com/apache/cordova-plugin-camera/pull/288
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/browser/CameraProxy.js b/src/browser/CameraProxy.js
index 38f241f9..7eb86bb3 100644
--- a/src/browser/CameraProxy.js
+++ b/src/browser/CameraProxy.js
@@ -102,9 +102,12 @@ function capture (success, errorCallback, opts) {
 
     var successCallback = function (stream) {
         localMediaStream = stream;
-        video.src = window.URL.createObjectURL(localMediaStream);
+        if ('srcObject' in video) {
+            video.srcObject = localMediaStream;
+        } else {
+            video.src = window.URL.createObjectURL(localMediaStream);
+        }
         video.play();
-
         document.body.appendChild(parent);
     };
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> URL.createObjectURL(stream) is deprecated! Use elem.srcObject = stream 
> instead!
> -------------------------------------------------------------------------------
>
>                 Key: CB-13384
>                 URL: https://issues.apache.org/jira/browse/CB-13384
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-camera
>         Environment: Browser
> * Safari - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) 
> AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Safari/604.1.38" 
> {color:red}(exception){color}
> * Chrome - "Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) 
> AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 
> Safari/601.1" {color:#f79232}(deprecation warning){color}
>            Reporter: Matt Vander Vliet
>            Priority: Trivial
>
> {{CameraProxy.js}} from {{cordova-camera-plugin}} has code deprecated by 
> Safari 11, and issues deprecation warnings in Chrome, etc. 
> Proposed fix:
> {code}
>      var successCallback = function (stream) {
>          localMediaStream = stream;
> -        video.src = window.URL.createObjectURL(localMediaStream);
> +        try {
> +            video.src = window.URL.createObjectURL(localMediaStream);
> +        } catch (e) {
> +            video.srcObject = localMediaStream;
> +        }
>          video.play();
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to