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..

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,828 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,254 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
867 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 55,686 Reputation points
    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.