[英]Video capture for Windows 8 desktop App (HTML + javascript). Not from webcam
I´m developing a Windows 8.1 App for desktop using HTML and Javascript. 我正在使用HTML和Javascript开发用于桌面的Windows 8.1应用程序。 I have a video grabber card and i would like to view the video being captured in real-time at my App. 我有一张视频采集卡,我想在我的应用程序中实时查看正在捕获的视频。 Searching the internet i´ve found some examples and tutorial of capturing video for a Windows 8 App, but all of them are with the webcam, and i would like to know if that should be applicable to any "capture device" like my capture card. 在互联网上搜索,我发现了一些示例和捕获Windows 8 App视频的教程,但是所有这些都与网络摄像头一起使用,我想知道这是否适用于任何“捕获设备”(例如我的捕获卡) 。
I´ve followed this MSDN tutorial with no success. 我没有成功完成此MSDN教程。
http://msdn.microsoft.com/en-us/library/windows/apps/hh452791.aspx http://msdn.microsoft.com/en-us/library/windows/apps/hh452791.aspx
EDIT (adding some more info): 编辑(添加更多信息):
If you follow the tutorial, the detection of capture devices whith the code bellow is ok, it properly detects my capture card. 如果您按照本教程进行操作,则可以通过下面的代码检测捕获设备,从而正确检测到我的捕获卡。
var deviceInfo = Windows.Devices.Enumeration.DeviceInformation;
deviceInfo.findAllAsync(Windows.Devices.Enumeration.DeviceClass.videoCapture).then(function (devices) {
// Add the devices to deviceList
if (devices.length > 0) {
for (var i = 0; i < devices.length; i++) {
deviceList.push(devices[i]);
}
initCaptureSettings();
initMediaCapture();
document.getElementById("message").innerHTML = "Initialization complete.";
} else {
document.getElementById("error").innerHTML("No video device is found ");
}
}, errorHandler);
But then, it throws an "Access denied" exception at the "oMediaCapture.initializeAsync(captureInitSettings)" at the following section of code: 但是随后,它在以下代码部分的“ oMediaCapture.initializeAsync(captureInitSettings)”处引发“访问被拒绝”异常:
// Create and initialze the MediaCapture object.
function initMediaCapture() {
oMediaCapture = null;
oMediaCapture = new Windows.Media.Capture.MediaCapture();
oMediaCapture.initializeAsync(captureInitSettings).then (function (result) {
createProfile();
}, errorHandler);
}
I think this could be because of some kind of access permission to the capture device ¿?¿? 我认为这可能是因为对捕获设备有某种访问权限。 Any help? 有什么帮助吗?
Thanks in advance!! 提前致谢!!
If you only care about the video and do not want to use the audio, just make sure that the settings passed to InitializeAsync() specifies StreamingCaptureMode correctly: 如果您只关心视频而又不想使用音频,则只需确保传递给InitializeAsync()的设置正确指定了StreamingCaptureMode:
mediaCapture = new MediaCapture();
MediaCaptureInitializationSettings initSettings = new MediaCaptureInitializationSettings();
initSettings.VideoDeviceId = Webcam.Id;
initSettings.StreamingCaptureMode = StreamingCaptureMode.Video; // <----
await mediaCapture.InitializeAsync(initSettings);
Kudos to Slimacik. 对Slimacik表示敬意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.