<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: QV Develop</title>
    <description>The latest articles on DEV Community by QV Develop (@qvdev).</description>
    <link>https://dev.to/qvdev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F250197%2F236ef3a9-2e1f-4621-b507-6860f23ad1b7.png</url>
      <title>DEV Community: QV Develop</title>
      <link>https://dev.to/qvdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qvdev"/>
    <language>en</language>
    <item>
      <title>MediaRecorder power UP!</title>
      <dc:creator>QV Develop</dc:creator>
      <pubDate>Thu, 18 Jun 2020 08:51:46 +0000</pubDate>
      <link>https://dev.to/qvdev/mediarecorder-power-up-5b1l</link>
      <guid>https://dev.to/qvdev/mediarecorder-power-up-5b1l</guid>
      <description>&lt;p&gt;After a long time fiddling with MSE(MediaSourceBuffer) and canvas to record video/audio from a HtmlVideoElement where the stream constantly change between screen sharing and camera I finally found a solution to keep recording without MediaRecording stop recording.&lt;/p&gt;

&lt;p&gt;Luckily I was not the only one with this problem see the following references:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://discourse.mozilla.org/t/switch-stream-in-media-recorder/27619/3"&gt;https://discourse.mozilla.org/t/switch-stream-in-media-recorder/27619/3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/59846230/mediarecorder-switch-video-tracks"&gt;https://stackoverflow.com/questions/59846230/mediarecorder-switch-video-tracks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So what did I do? I used the following example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://webrtc.github.io/samples/src/content/peerconnection/pc1/"&gt;https://webrtc.github.io/samples/src/content/peerconnection/pc1/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used the above sample code to create a new library that extends MediaStream functionality to change streams with the MediaRecorder breaking.&lt;/p&gt;

&lt;p&gt;So what happens?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup local PeerConnection on the same website. webcam/screen Stream -&amp;gt; "remote" Video&lt;/li&gt;
&lt;li&gt;Once the sender start sending the stream it makes an RTPSender and that has the changeTrack capability&lt;/li&gt;
&lt;li&gt;Save the RTPSender and use it to switch streams. This will end up in the "remote" Video&lt;/li&gt;
&lt;li&gt;Attach the MediaRecorder to the "remote" Video and start recording.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No you are able to switch the streams on the "local" video and it directly sends it to the "remote" Video.&lt;/p&gt;

&lt;p&gt;I made the library open source and you can find it here &lt;a href="https://github.com/meething/StreamSwitcher"&gt;StreamSwitcher&lt;/a&gt; also there is a demo so feel free to try out &lt;a href="https://meething.github.io/StreamSwitcher/"&gt;DEMO&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This library is part of &lt;a href="http://web.meething.space/"&gt;Meething&lt;/a&gt; a privacy first browser based video conference using dweb technology. Feel free to try out.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
