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

videoEl.render is undefined #479

Closed
GProst opened this issue Mar 27, 2020 · 6 comments
Closed

videoEl.render is undefined #479

GProst opened this issue Mar 27, 2020 · 6 comments
Assignees
Milestone

Comments

@GProst
Copy link
Contributor

GProst commented Mar 27, 2020

I want to capture video screenshot on a canvas, there is an example that says there is videoEl.render.save method which can be used
source1: #116 (comment)
source2: #454 (comment)

Expected behavior

videoEl.render is present with 'save' method on it

Observerd behavior

videoEl.render is undefined

Steps to reproduce the problem

Just create an HTML video element after running cordova.plugins.iosrtc.registerGlobals(), it won't have render prop set

Platform information

  • Cordova version: 5.0.1
  • Plugin version: 6.0.9
  • iOS version: 13.4
  • Xcode version: 11.4
@hthetiot
Copy link
Contributor

hthetiot commented Mar 30, 2020

Assuming you attached the stream to the video this should works:

@GProst
Copy link
Contributor Author

GProst commented Mar 30, 2020

@hthetiot yup, I saw that example but it doesn't work for me =/
I set videoEl.srcObject = stream where stream is an object resolved after calling navigator.mediaDevices.getUserMedia

Get the following error:

An error occurred: TypeError: undefined is not an object (evaluating 'videoEl.render.save')

@hthetiot
Copy link
Contributor

hthetiot commented Apr 1, 2020

@GProst I will recheck will keep you posted.

@hthetiot hthetiot self-assigned this Apr 1, 2020
@hthetiot hthetiot added the bug label Apr 1, 2020
@hthetiot hthetiot added this to the 6.0.9 milestone Apr 1, 2020
@GProst
Copy link
Contributor Author

GProst commented Apr 3, 2020

@hthetiot I found the problem. render is absent if I access it right after I set srcObject on video (i.e. synchronously after that), it is present if I access it in setTimeout(..., 0)

Perhaps this is expected? But I wasn't aware

@hthetiot
Copy link
Contributor

hthetiot commented Apr 3, 2020

@GProst Thank you,

Yes that because the video tag was not rendered yet, you can subscribe to MediaElement events to make sure it's rendered. (example: loadedmetadata)

Thank you for solving your own issue.

@hthetiot hthetiot closed this as completed Apr 3, 2020
@hthetiot hthetiot added help wanted and removed bug labels Apr 3, 2020
@GProst
Copy link
Contributor Author

GProst commented Apr 3, 2020

@hthetiot thank you for your awesome work on this plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants