239 lines
13 KiB
HTML
239 lines
13 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html>
|
|
<head><link rel="stylesheet" type="text/css" href="description/Combined.css,0:SearchBox,0:ImageSprite;/Areas/Epx/Themes/Metro/Content:0&amp;hashKey=E778FABBB649835AFE4E73BCAC4F643A" xmlns="http://www.w3.org/1999/xhtml" />
|
|
<link rel="stylesheet" type="text/css" href="description/4ee0dda0-3e7e-46df-b80b-1692acc1c812Combined.css,0:ImageSprite;/Areas/Epx/Themes/Metro/Content:0&amp;hashKey=B88AD897C8197B762EA1BF0238A60A9F" xmlns="http://www.w3.org/1999/xhtml" />
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>Media capture using capture device sample</title>
|
|
<link href="description/Galleries.css" type="text/css" rel="Stylesheet" /><link href="description/Layout.css" type="text/css" rel="Stylesheet" /><link href="description/Brand.css" type="text/css" rel="Stylesheet" /><link href="description/c2e69f54-1c43-4037-b90b-5f775f1d945fBrand.css" type="text/css" rel="Stylesheet" />
|
|
<link href="description/iframedescription.css" rel="Stylesheet" type="text/css" />
|
|
<script src="description/offline.js" type="text/javascript"></script>
|
|
<style type="text/css">
|
|
#projectInfo {
|
|
overflow: auto;
|
|
}
|
|
#longDesc {
|
|
clear:both;
|
|
margin: 25px 0 10px 0;
|
|
}
|
|
|
|
#SampleIndexList{
|
|
margin-left: 15px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="offlineDescription">
|
|
<h1>Media capture using capture device sample</h1>
|
|
<br/>
|
|
<div id="projectInfo">
|
|
<div class="section">
|
|
<div class="itemBarLong tagsContainer">
|
|
<label for="Technologies">Technologies</label>
|
|
<div id="Technologies">
|
|
Windows Runtime
|
|
</div>
|
|
</div>
|
|
<div class="itemBarLong tagsContainer">
|
|
<label for="Topics">Topics</label>
|
|
<div id="Topics">
|
|
Devices and sensors
|
|
</div>
|
|
</div>
|
|
<div class="itemBarLong">
|
|
<label for="Platforms">Platforms</label>
|
|
<div id="Platforms">
|
|
Windows RT
|
|
</div>
|
|
</div>
|
|
<div class="itemBarLong">
|
|
<label for="Requirements">Requirements</label>
|
|
<div id="Requirements">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="itemBar">
|
|
<label for="LastUpdated">Primary Language</label>
|
|
<div id="LastUpdated">en-US</div>
|
|
</div>
|
|
<div class="itemBar">
|
|
<label for="LastUpdated">Last Updated</label>
|
|
<div id="LastUpdated">4/9/2013</div>
|
|
</div>
|
|
<div class="itemBarLong">
|
|
<label for="License">License</label>
|
|
<div id="License">
|
|
<a href="license.rtf">MS-LPL</a></div>
|
|
</div>
|
|
<div class="itemBar">
|
|
<div class="viewonlinecont">
|
|
<a data-link="online" href="http://code.msdn.microsoft.com/windowsapps/Media-Capture-Sample-adf87622">View this sample online</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
function initializePage() {
|
|
var otherTabClass = 'otherTab';
|
|
var hiddenPreClass = 'hidden';
|
|
|
|
var htmlDecode = function(encodedData) {
|
|
var decodedData = "";
|
|
if (encodedData) {
|
|
var div = document.createElement('div');
|
|
div.innerHTML = encodedData;
|
|
decodedData = div.firstChild.nodeValue.replace( /\\r\\n/ig , '\r\n');
|
|
}
|
|
return decodedData;
|
|
};
|
|
|
|
Galleries.iterateElem(Galleries.findElem(null, 'div', 'scriptcode'), function (index, scriptBlock) {
|
|
var titleElem = Galleries.findElem(scriptBlock, 'div', 'title')[0];
|
|
var labelElems = Galleries.findElem(titleElem, 'span');
|
|
if (labelElems.length == 0) {
|
|
labelElems = titleElem;
|
|
}
|
|
var languageSpans = Galleries.findElem(scriptBlock, 'span', 'hidden');
|
|
var pres = Galleries.findElem(scriptBlock, 'pre');
|
|
if (languageSpans.length > 0 && pres.length > 1) {
|
|
Galleries.iterateElem(labelElems, function(index, elem) {
|
|
var codePre = pres[index];
|
|
var labelSpan = elem;
|
|
var languageSpan = languageSpans[index];
|
|
|
|
elem.code = codePre.innerHTML.replace( /(\r(\n)?)|((\r)?\n)/ig , '\\r\\n');
|
|
|
|
codePre.className = codePre.className.replace(hiddenPreClass, '');
|
|
|
|
languageSpan.parentNode.removeChild(languageSpan);
|
|
});
|
|
|
|
pres = Galleries.findElem(scriptBlock, 'pre');
|
|
Galleries.iterateElem(labelElems, function(index, elem) {
|
|
var codePre = pres[index];
|
|
var labelSpan = elem;
|
|
if (index == 0) {
|
|
scriptBlock.activeTab = 0;
|
|
}
|
|
else {
|
|
labelSpan.className += otherTabClass;
|
|
codePre.className += hiddenPreClass;
|
|
}
|
|
Galleries.attachEventHandler(labelSpan, 'click', function(e) {
|
|
var activeTab = scriptBlock.activeTab;
|
|
labelElems[activeTab].className += otherTabClass;
|
|
pres[activeTab].className += hiddenPreClass;
|
|
|
|
codePre.className = codePre.className.replace(hiddenPreClass, '');
|
|
labelSpan.className = labelSpan.className.replace(otherTabClass, '');
|
|
scriptBlock.activeTab = index;
|
|
});
|
|
});
|
|
|
|
var preview = Galleries.findElem(scriptBlock, 'div', 'preview');
|
|
if (preview.length == 0) {
|
|
preview.push(pres[pres.length - 1]);
|
|
}
|
|
Galleries.iterateElem(preview, function(index, elem) {
|
|
elem.parentNode.removeChild(elem);
|
|
});
|
|
|
|
if (window.clipboardData && clipboardData.setData) {
|
|
var copyLink = document.createElement('a');
|
|
copyLink.href = 'javascript:void(0);';
|
|
copyLink.className = 'copyCode';
|
|
copyLink.innerHTML = 'Copy Code';
|
|
Galleries.attachEventHandler(copyLink, 'click', function (e) {
|
|
clipboardData.setData("Text", htmlDecode(labelElems[scriptBlock.activeTab].code));
|
|
return false;
|
|
});
|
|
scriptBlock.insertBefore(copyLink, scriptBlock.childNodes[0]);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
Galleries.onWindowLoad(function(){
|
|
initializePage();
|
|
});
|
|
|
|
</script>
|
|
<div id="longDesc">
|
|
|
|
<div id="mainSection">
|
|
<p>This sample demonstrates how to use the <a href="http://msdn.microsoft.com/library/windows/apps/BR241124">
|
|
<b>MediaCapture</b> </a>API to capture video, audio, and pictures from a capture device, such as a webcam.
|
|
</p>
|
|
<p>Specifically, this sample covers: </p>
|
|
<ul>
|
|
<li>Previewing video from a capture device, such as a webcam, connected to the computer.
|
|
</li><li>Capturing video from a capture device, such as a webcam, connected to the computer.
|
|
</li><li>Taking a picture from a capture device, such as a webcam, connected to the computer.
|
|
</li><li>Enumerating cameras connected to the computer. </li><li>Adding a video effect to a video. </li><li>Recording audio from a capture device connected to the computer. </li></ul>
|
|
<p></p>
|
|
<p>For more information on capturing video in your app, see <a href="http://msdn.microsoft.com/library/windows/apps/Hh465152">
|
|
Quickstart: capturing a photo or video using the camera dialog</a> and <a href="http://msdn.microsoft.com/library/windows/apps/Hh452791">
|
|
Quickstart: capturing video using the MediaCapture API</a>.</p>
|
|
<p class="note"><b>Important</b> </p>
|
|
<p class="note">This sample uses the Media Extension feature of Windows 8 to add functionality to the Microsoft Media Foundation pipeline. A Media Extension consists of a hybrid object that implements both Component Object Model (COM) and Windows Runtime
|
|
interfaces. The COM interfaces interact with the Media Foundation pipeline. The Windows Runtime interfaces activate the component and interact with the Windows Store app.
|
|
</p>
|
|
<p class="note">In most situations, it is recommended that you use Visual C++ with Component Extensions (C++/CX ) to interact with the Windows Runtime. But in the case of hybrid components that implement both COM and Windows Runtime interfaces, such as Media
|
|
Extensions, this is not possible. C++/CX can only create Windows Runtime objects. So, for hybrid objects it is recommended that you use
|
|
<a href="http://go.microsoft.com/fwlink/p/?linkid=243149">Windows Runtime C++ Template Library</a> to interact with the Windows Runtime. Be aware that Windows Runtime C++ Template Library has limited support for implementing COM interfaces.</p>
|
|
<p></p>
|
|
<p>To obtain an evaluation copy of Windows 8, go to <a href="http://go.microsoft.com/fwlink/p/?linkid=241655">
|
|
Windows 8</a>.</p>
|
|
<p>To obtain an evaluation copy of Microsoft Visual Studio 2012, go to <a href="http://go.microsoft.com/fwlink/p/?linkid=241656">
|
|
Visual Studio 2012</a>.</p>
|
|
<h3><a id="related_topics"></a>Related topics</h3>
|
|
<dl><dt><a href="http://go.microsoft.com/fwlink/p/?LinkID=227694">Windows 8 app samples</a>
|
|
</dt><dt><b>Roadmaps</b> </dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh465134">Adding multimedia</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465156">Capturing or rendering audio, video, and images</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh767284">Designing UX for apps</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/BR229583">Roadmap for apps using C# and Visual Basic</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh700360">Roadmap for apps using C++</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh465037">Roadmap for apps using JavaScript</a>
|
|
</dt><dt><b>Tasks</b> </dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh465152">Quickstart: capturing a photo or video using the camera dialog</a>
|
|
</dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/Hh452791">Quickstart: capturing video using the MediaCapture API</a>
|
|
</dt><dt><b>Reference</b> </dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/BR211961"><b>AddEffectAsync</b>
|
|
</a></dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/BR226592"><b>ClearEffectsAsync</b>
|
|
</a></dt><dt><a href="http://msdn.microsoft.com/library/windows/apps/BR241124"><b>MediaCapture</b>
|
|
</a></dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/BR226581"><b>MediaCaptureSettings</b>
|
|
</a></dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh701026"><b>MediaEncodingProfile</b>
|
|
</a></dt><dt><a href="http://msdn.microsoft.com/en-us/library/windows/apps/Hh700863"><b>StartRecordToStorageFileAsync</b>
|
|
</a></dt><dt><b>Windows.Media.Capture</b> </dt></dl>
|
|
<h3>Operating system requirements</h3>
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<th>Client</th>
|
|
<td><dt>Windows 8 </dt></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Server</th>
|
|
<td><dt>Windows Server 2012 </dt></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3>Build the sample</h3>
|
|
<p></p>
|
|
<ol>
|
|
<li>Start Visual Studio Express 2012 for Windows 8 and select <b>File</b> > <b>
|
|
Open</b> > <b>Project/Solution</b>. </li><li>Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio Express 2012 for Windows 8 Solution (.sln) file.
|
|
</li><li>Press F7 or use <b>Build</b> > <b>Build Solution</b> to build the sample. </li></ol>
|
|
<p></p>
|
|
<h3>Run the sample</h3>
|
|
<p>To debug the app and then run it, press F5 or use <b>Debug</b> > <b>Start Debugging</b>. To run the app without debugging, press Ctrl+F5 or use
|
|
<b>Debug</b> > <b>Start Without Debugging</b>.</p>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|