locked
Two ore more instances of MediaCapture

    Question

  • I'm creating an app that will show preview of a few cameras. If I try and use more than once instance of MediaCapture, the second camera will not show. If I comment out or remove the first instance of MediaCapture, the second camera displays just fine. How can I display more than one camera preview at a time? 
    Wednesday, September 17, 2014 12:15 AM

Answers

  • Solved:

    Apparently the problem was with the hub. After I replaced the hub with one that presents more power, the problem is solved. A simple delay allows me to add however many cameras I want. 

    • Marked as answer by Breaker1253 Friday, September 19, 2014 5:35 PM
    Friday, September 19, 2014 5:35 PM

All replies

  • After a little more playing around, I was able to get a second camera to work after adding a 3 second delay task.delay(3000). Now when adding the third camera, the other two cameras freeze. The Second and third camera are on the same USB hub. If I try and add those two cameras first, it freezes on loading the second camera. 
    Wednesday, September 17, 2014 12:31 AM
  • Hi Breaker1253,

    Take a look at the documentation, you cannot initialize two camera at same time as you can also see 3 seconds delay make the app works fine.

    In C# or C++ apps, the first use of the MediaCapture object  to call InitializeAsync should be on the STA thread. Calls from an MTA thread may result in undefined behavior.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 18, 2014 8:03 AM
    Moderator
  • Solved:

    Apparently the problem was with the hub. After I replaced the hub with one that presents more power, the problem is solved. A simple delay allows me to add however many cameras I want. 

    • Marked as answer by Breaker1253 Friday, September 19, 2014 5:35 PM
    Friday, September 19, 2014 5:35 PM