Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-13384: (browser) Added deprecation of video.src compatibility #288

Merged

Conversation

mvandervliet
Copy link
Contributor

@mvandervliet mvandervliet commented Oct 3, 2017

Platforms affected

Browser

What does this PR do?

Updates CameraProxy.js to support video.srcObject and preserves backwards compatibility with URL.createObjectURL

What testing has been done on this change?

Browser

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

@rtm
Copy link

rtm commented May 2, 2018

Is something holding up the merging of this PR?

@charlesverge
Copy link

@mvandervliet The solution I used is

            localMediaStream = stream;
            if (typeof video.srcObject !== 'undefined') {
                video.srcObject = stream;
            } else {
                video.src = window.URL.createObjectURL(localMediaStream);
            }

@mvandervliet
Copy link
Contributor Author

Thanks @charlesverge - Yes that would work as well, effectively the same functionally, perhaps more direct with the srcObject property check. @rtm - I don't know what is preventing the merge.

@@ -102,7 +102,11 @@ function capture (success, errorCallback, opts) {

var successCallback = function (stream) {
localMediaStream = stream;
video.src = window.URL.createObjectURL(localMediaStream);
try {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do property detection instead of a try/catch.

if ('srcObject' in video) {
   // 
} else {
   //
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks @shazron

@shazron shazron merged commit 5163d38 into apache:master May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants