Answered by:
Runtime error about addEffectAsync when preivew capture?

Question
-
Dear Sir,
I tried to use addEffectAsync to add built in video stabilization at webcam preview, but I got runtime error at JavaScript, which said "A method was called at an unexpected time."
The following is my code snip. Is the calling sequence correct? Thanks.
var video_tag = document.getElementById("video_capture");
m_media_capture = new Windows.Media.Capture.MediaCapture();
m_media_capture.initializeAsync().then(function () {
m_media_capture.addEffectAsync(Windows.Media.Capture.MediaStreamType.videoPreview,
"Windows.Media.VideoEffects.VideoStabilization", null).then(function () {
video_tag.src = URL.createObjectURL(m_media_capture, false);
video_tag.play();
}, errorHandler);
}, errorHandler);
Chik
- Edited by ChikC Wednesday, January 11, 2012 10:07 AM
Wednesday, January 11, 2012 10:07 AM
Answers
-
Hello Chik,
Please take a look at this sample code. If you still have questions after reviewing this documentation please let me know and I will do what I can to help.
How to add video stabilization
http://msdn.microsoft.com/en-us/library/windows/apps/hh465140.aspx
Thanks,
James
Windows Media SDK Technologies
Microsoft Developer Services
http://blogs.msdn.com/mediasdkstuff/- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Wednesday, January 18, 2012 1:22 PM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, January 30, 2012 1:04 PM
Monday, January 16, 2012 10:15 PMModerator
All replies
-
Hello Chik,
Please take a look at this sample code. If you still have questions after reviewing this documentation please let me know and I will do what I can to help.
How to add video stabilization
http://msdn.microsoft.com/en-us/library/windows/apps/hh465140.aspx
Thanks,
James
Windows Media SDK Technologies
Microsoft Developer Services
http://blogs.msdn.com/mediasdkstuff/- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Wednesday, January 18, 2012 1:22 PM
- Marked as answer by Jeff SandersMicrosoft employee, Moderator Monday, January 30, 2012 1:04 PM
Monday, January 16, 2012 10:15 PMModerator -
Hi James,
The sample code looks so simple but I just cannot find the correct calling sequence about "initializeAsync", "addEffectAsync", and "start preview on HTML video tag."
In my code snip, the effect has been added, but the runtime error appears when the debug mode is "Script Only". Do I miss something?
Thanks for your reply.
Chik
Tuesday, January 17, 2012 1:59 AM -
Chik,
Sorry for the late reply. Are you still having problems with this API? If so please let me know and I will make sure we get you some help.
-James
James Windows Media SDK Technologies Microsoft Developer Services http://blogs.msdn.com/mediasdkstuff/Friday, January 27, 2012 11:15 PMModerator -
Hi James,
Thanks for your reply. I change to add effect during the video of preview is playing, and the error disappeared. Thanks.
Chik
- Edited by ChikC Monday, January 30, 2012 2:58 AM
Monday, January 30, 2012 2:57 AM