<?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: Janavi Anand</title>
    <description>The latest articles on DEV Community by Janavi Anand (@janavianand).</description>
    <link>https://dev.to/janavianand</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%2F174055%2F9bed8a26-9a4c-4551-b992-8e069cd79524.png</url>
      <title>DEV Community: Janavi Anand</title>
      <link>https://dev.to/janavianand</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/janavianand"/>
    <language>en</language>
    <item>
      <title>Electron App live streaming— MAC OS</title>
      <dc:creator>Janavi Anand</dc:creator>
      <pubDate>Thu, 16 Jul 2020 14:29:11 +0000</pubDate>
      <link>https://dev.to/janavianand/electron-app-live-streaming-mac-os-18m5</link>
      <guid>https://dev.to/janavianand/electron-app-live-streaming-mac-os-18m5</guid>
      <description>&lt;p&gt;Recently I was working in an Electron app, to set up a live video. It was a very basic set up. I am using MAC OS - Catalina.&lt;/p&gt;

&lt;p&gt;I am new to Electron and forked the repo that has the basic set up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/hokein/electron-sample-apps/tree/master/camera"&gt;git-hub link to project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I followed all the steps, but I could not get my video or audio consent window.&lt;/p&gt;

&lt;p&gt;After spending some on debugging it, came across the doc,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.electronjs.org/docs/api/system-preferences#systempreferencesaskformediaaccessmediatype-macos"&gt;electron-docs&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;systemPreferences.askForMediaAccess('camera').then((allowed)=&amp;gt;console.log('Camera is allowed'))&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Adding the above lines in &lt;code&gt;main.js&lt;/code&gt; , should solve the issue.&lt;br&gt;
However, I ran &lt;code&gt;electron .&lt;/code&gt; in my folder and the whole app crashed.&lt;/p&gt;

&lt;p&gt;I was doing all this from my VS Code terminal, which crashed the app. We need to get permission to access the camera for the electron app and looks like the permissions were requested for VS Code.&lt;/p&gt;

&lt;p&gt;Starting the server from Terminal or iTerm (I used iTerm), solved the issue, which requested permission for the app. Once the permission or user consent is given, I was able to access the camera, for other electrons app as well. It is a one time setup and it enables us to access the camera for other apps as well, without going over the above code set up.&lt;/p&gt;

&lt;h2&gt;
  
  
  REFERENCES
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.electronjs.org/docs/api/system-preferences#systempreferencesaskformediaaccessmediatype-macos"&gt;https://www.electronjs.org/docs/api/system-preferences#systempreferencesaskformediaaccessmediatype-macos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/58290668/electron-osx-systempreferences-askformediaaccess-crashes-app"&gt;https://stackoverflow.com/questions/58290668/electron-osx-systempreferences-askformediaaccess-crashes-app&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>electron</category>
      <category>video</category>
      <category>videostreaming</category>
      <category>userconsent</category>
    </item>
  </channel>
</rss>
