How we call directshow filter (virtual web cam) method from Javascript web

ravi poddar 11 Reputation points
2022-08-20T10:45:31.857+00:00

How we call direct show filter method from Javascript web

I am working on directshow.net to show virtual web cam in html .i need some method call from javascript to my custom directshow filter .so how will do this

references : https://www.codeproject.com/Articles/421167/Pure-NET-DirectShow-Filters-in-Csharp

java script code to load virtual webcam :

navigator.mediaDevices.enumerateDevices()  
                .then((devices) => {  
                    devices.forEach((device) =>  
                    {  
                        console.log(`${device.kind}: ${device.label} id = ${device.deviceId}`);  
                        if (device.label == "My Virtual Camera") {  
                               
                            myVirtualdevice = device;  
      
                            navigator.mediaDevices.getUserMedia(  
                                {  
                                        video:  
                                        {  
                                            deviceId: myVirtualdevice.deviceId   
                                        }  
                                }  
                            ).then(function (stream) {  
                                console.log("Found Virtual Camera");  
                                video.srcObject = stream;  
                            })  
                            .catch(function (err0r)  
                                {  
                                    console.log("Something went  wrong!");  
                                });  
                        }  
                          
                           
                    });  
                })  
                .catch((err) => {  
                    console.error(`${err.name}: ${err.message}`);  
                });   
  

  

Now I want to call VideoHtmlElement.MyCustomMethod() that will received in MyCustomDirectShow filter..

Developer technologies | Windows Forms
Microsoft 365 and Office | Development | Office JavaScript API
Developer technologies | .NET | .NET Runtime
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2022-08-20T16:19:58.737+00:00

    JavaScript can not call that library directly. The code would need to be hosted by a web server, that the JavaScript streamed the video to. Google for sample code.

    You don’t explain your use case, so it’s hard to say more.

    Note: if the library was pure C# and didn’t require threads it could be converted to a WASM assembly callable from JavaScript. This library does not qualify as it’s just a wrapper around a window 32 library.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.