Skip to content

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

Merged
shazron merged 2 commits intoapache:masterfrom
mvandervliet:bugfix/CB-13384_video_src_deprecation
May 25, 2018
Merged

CB-13384: (browser) Added deprecation of video.src compatibility#288
shazron merged 2 commits intoapache:masterfrom
mvandervliet:bugfix/CB-13384_video_src_deprecation

Conversation

@mvandervliet
Copy link
Copy Markdown
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
Copy Markdown

rtm commented May 2, 2018

Is something holding up the merging of this PR?

@charlesverge
Copy link
Copy Markdown

@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
Copy Markdown
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.

var successCallback = function (stream) {
localMediaStream = stream;
video.src = window.URL.createObjectURL(localMediaStream);
try {
Copy link
Copy Markdown
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
Copy Markdown
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.

4 participants