Windows 10: Announcing media capture functionality in Microsoft Edge

Discus and support Announcing media capture functionality in Microsoft Edge in Windows 10 News to solve the problem; In the latest Windows 10 preview release, we added support for media capture APIs in Microsoft Edge for the first time. This feature is based on the... Discussion in 'Windows 10 News' started by Brink, May 12, 2015.

  1. Brink
    Brink New Member

    Announcing media capture functionality in Microsoft Edge


    Here is one example which accounts for the legacy srcObject approach before all browsers support the standards-based approach:

    Code: var video = document.getElementById('videoTag'); if (typeof(video.srcObject != "undefined") { video.srcObject = stream; } else { video.src = URL.createObjectURL(stream); }[/quote] Next, copy a video frame onto a canvas. Let’s assume we have set up the event listener so when you tap the video tag, we will invoke the following function:

    Code: function capturePhoto() { var video = document.getElementById('videoTag'); var canvas = document.getElementById('canvasTag'); var videoWidth = video.videoWidth; var videoHeight = video.videoHeight; if (canvas.width !== videoWidth || canvas.height !== videoHeight) { canvas.width = videoWidth; canvas.height = videoHeight; } var ctx = canvas.getContext('2d'); ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); }[/quote] Finally, save the picture:

    Code: function savePhoto() { var canvas = document.getElementById('canvasTag'); var imgData = canvas.msToBlob("image/jpeg"); navigator.msSaveBlob(imgData, "myPhoto.jpg"); }[/quote] You can also change code here to upload the data blob to your web server.

    Don’t forget to release the webcam device after you complete the task. Some earlier browser implementations have a stop() method on the MediaStream object. That is not supported by the W3C spec. Instead, you should call the stop() method on the MediaStreamTrack object to release the capture device. For example:

    Code: var video = document.getElementById('videoTag'); var videoTracks = mediaStream.getVideoTracks(); video.srcObject = null; videoTracks[0].stop();[/quote] Once you know how to use one webcam, it should not be difficult to introduce a camera switching feature to your page to handle multiple webcams. You can check out our demo at the Microsoft Edge Dev site for more.

    Scenario #2: Capture a voice message from microphone
    Now let’s look at a simple example using the microphone.

    First, get an audio stream from a microphone and set it as the source node of a web audio graph.

    Code: var audioContext = new AudioContext(); navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) { var sourceNode = audioContext.createMediaStreamSource(stream); var gainNode = audioContext.createGain(); sourceNode.connect(gainNode); … }).catch( function (error) { console.log(error.name + ": " + error.message); });[/quote] Next, extract the audio data from a web audio ScriptProcessorNode. This is too lengthy to include here, but you can check out the actual demo code at the Microsoft Edge Dev site and GitHub repository, where you can also add some simple web audio DSP filters before the ScriptProcessorNode.

    Finally, save the audio data into a wav file. Once we have the audio data, we can add a wav file header and save the data blob. Again, please check out the actual demo code at the Microsoft Edge Dev site.

    We’ve only talked about a couple simple examples as starting points. Once you’ve gotten the captured video stream into a video tag and then canvas, and gotten captured audio into web audio, it’s easy to see many scenarios that start to light up with just a bit more work. We’re eager for your feedback so we can further improve our implementation, and meanwhile we are looking forward to seeing what you do with these new tools!

    – Shijun Sun, Senior Program Manager, Microsoft Edge [/quote]
    Source: http://blogs.windows.com/msedgedev/2...icrosoft-edge/

    :)
     
    Brink, May 12, 2015
    #1

  2. Printscreen/ screenshot?

    There have been no announcements related to screen capture and thus there's no way to infer
    if it will come to Windows Phone.
     
    Joel Ivory Johnson, May 12, 2015
    #2
  3. WMDC Won't even start....

    Dana's fix did the trick for me.... huge relief! Thanks.
     
    Edge Media, May 12, 2015
    #3
Thema:

Announcing media capture functionality in Microsoft Edge

Loading...
  1. Announcing media capture functionality in Microsoft Edge - Similar Threads - Announcing media capture

  2. Edge web capture

    in Windows 10 Ask Insider
    Edge web capture: Edge recently added something called web capture which is identical to the screen capture command that's been in Windows forever, it even uses the same keyboard shortcut. Is there any difference or point to this or they just arbitrarily renaming things? submitted by...
  3. Microsoft announces improvements to Collections in Microsoft Edge

    in Windows 10 News
    Microsoft announces improvements to Collections in Microsoft Edge: Over the last few months, we’ve introduced you to updated experiences for favorites and history that are designed to help you stay in your flow and finish tasks faster. Today, we’re excited to share that we’re bringing many of the same...
  4. Microsoft announces several features coming to Edge.

    in Windows 10 Ask Insider
    Microsoft announces several features coming to Edge.: submitted by /u/Leopeva64-2 [link] [comments] https://www.reddit.com/r/Windows10/comments/l7gin4/microsoft_announces_several_features_coming_to/
  5. Microsoft announces improvements to history in Microsoft Edge

    in Windows 10 News
    Microsoft announces improvements to history in Microsoft Edge: Today, we’re excited to share two significant updates to history in Microsoft Edge. We know you have all been eagerly awaiting history sync, and we’re thrilled to announce that we’ve started rolling out support for syncing your browsing...
  6. Introducing web capture for Microsoft Edge

    in Windows 10 News
    Introducing web capture for Microsoft Edge: Since the release of the new Microsoft Edge, we have heard a lot of feedback about missing the web notes tool that allowed you to capture and mark up content across the web. Frankly, we’ve missed it too! But first, we wanted to make it better. While web notes was...
  7. Microsoft Announces the Microsoft Edge Insider Bounty

    in Windows 10 News
    Microsoft Announces the Microsoft Edge Insider Bounty: This week, we released the first Beta preview of the next version of Microsoft Edge. Alongside this, Microsoft is excited to announce the launch of the Microsoft Edge Insider Bounty Program. We welcome researchers to seek out and disclose any high impact vulnerabilities they...
  8. Bringing Screen Capture to Microsoft Edge with the Media Capture API

    in Windows 10 News
    Bringing Screen Capture to Microsoft Edge with the Media Capture API: Beginning with the EdgeHTML 17, Microsoft Edge is the first browser to support Screen Capture via the Screen Capture API. Web developers can start building on this feature today by upgrading to the Windows 10 April 2018 Update, or using one of our free virtual machines....
  9. Announcing Microsoft Edge for iOS and Android, Microsoft Launcher

    in Windows 10 News
    Announcing Microsoft Edge for iOS and Android, Microsoft Launcher: Tweet — Twitter API (@user) date[/quote] You’re standing in line at a coffee shop. Your right thumb is stre-t-ch-ing to drag out words on your phone’s keyboard while you squint to read the text on the web form you’re filling out. It’s amazing what’s possible...
  10. Announcing VP9 support coming to Microsoft Edge

    in Windows 10 News
    Announcing VP9 support coming to Microsoft Edge: Today, we’re excited to announce that WebM/VP9 support is now in development in Microsoft Edge. VP9 is an open source codec that offers efficient compression to stream HD content at lower bitrates, and is well suited to UHD streaming. Initial support for VP9 will be available...