Electron video cannot play Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Using console.log() in Electron appElectron: jQuery is not definedWebpack cannot find module 'electron'electron-builder vs electron-packagerConverting video for electronCannot play offline video in production electron appElectron and typescript “Cannot find module 'electron'”Typescript cannot locate declaration file for electronYoutube video playing on browser but not on electron-js appElectron cannot find module grpc.node

Could a cockatrice have parasitic embryos?

Raising a bilingual kid. When should we introduce the majority language?

How was Lagrange appointed professor of mathematics so early?

Was there ever a LEGO store in Miami International Airport?

When speaking, how do you change your mind mid-sentence?

"Working on a knee"

Why did Israel vote against lifting the American embargo on Cuba?

What to do with someone that cheated their way though university and a PhD program?

Is there a verb for listening stealthily?

Putting Ant-Man on house arrest

Retract an already submitted Recommendation Letter (written for an undergrad student)

How would you suggest I follow up with coworkers about our deadline that's today?

Marquee sign letters

What is a 'Key' in computer science?

When I export an AI 300x60 art board it saves with bigger dimensions

Suing a Police Officer Instead of the Police Department

What is the definining line between a helicopter and a drone a person can ride in?

My admission is revoked after accepting the admission offer

How to keep bees out of canned beverages?

What's called a person who works as someone who puts products on shelves in stores?

Are there existing rules/lore for MTG planeswalkers?

Is it appropriate to mention a relatable company blog post when you're asked about the company?

Coin Game with infinite paradox

How to begin with a paragraph in latex



Electron video cannot play



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Using console.log() in Electron appElectron: jQuery is not definedWebpack cannot find module 'electron'electron-builder vs electron-packagerConverting video for electronCannot play offline video in production electron appElectron and typescript “Cannot find module 'electron'”Typescript cannot locate declaration file for electronYoutube video playing on browser but not on electron-js appElectron cannot find module grpc.node



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have



<video id="video_player">
<source id="video_player_source"/>
</video>


in my html file, and



const videoPlayer = document.getElementById("video_player") as HTMLVideoElement;
const videoPlayerSource = document.getElementById("video_player_source") as HTMLElement;
videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
videoPlayerSource.setAttribute("src", "https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
videoPlayer.play();


in my renderer process (the video is a demo video).
The video did load (one frame of the video shows on screen), but it doesn't play when I call play().



How do I fix this? Thanks.










share|improve this question




























    0















    I have



    <video id="video_player">
    <source id="video_player_source"/>
    </video>


    in my html file, and



    const videoPlayer = document.getElementById("video_player") as HTMLVideoElement;
    const videoPlayerSource = document.getElementById("video_player_source") as HTMLElement;
    videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
    videoPlayerSource.setAttribute("src", "https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
    videoPlayer.play();


    in my renderer process (the video is a demo video).
    The video did load (one frame of the video shows on screen), but it doesn't play when I call play().



    How do I fix this? Thanks.










    share|improve this question
























      0












      0








      0








      I have



      <video id="video_player">
      <source id="video_player_source"/>
      </video>


      in my html file, and



      const videoPlayer = document.getElementById("video_player") as HTMLVideoElement;
      const videoPlayerSource = document.getElementById("video_player_source") as HTMLElement;
      videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
      videoPlayerSource.setAttribute("src", "https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
      videoPlayer.play();


      in my renderer process (the video is a demo video).
      The video did load (one frame of the video shows on screen), but it doesn't play when I call play().



      How do I fix this? Thanks.










      share|improve this question














      I have



      <video id="video_player">
      <source id="video_player_source"/>
      </video>


      in my html file, and



      const videoPlayer = document.getElementById("video_player") as HTMLVideoElement;
      const videoPlayerSource = document.getElementById("video_player_source") as HTMLElement;
      videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
      videoPlayerSource.setAttribute("src", "https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
      videoPlayer.play();


      in my renderer process (the video is a demo video).
      The video did load (one frame of the video shows on screen), but it doesn't play when I call play().



      How do I fix this? Thanks.







      typescript electron






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 9 at 4:43









      Yutong ZhangYutong Zhang

      32




      32






















          1 Answer
          1






          active

          oldest

          votes


















          0














          MediaElement.play() returns a Promise as of version:



          Firefox: 53



          'Chrome for Desktop', 'Chrome for Android', 'Android WebView': 50



          'Opera', 'Opera for Android': 37



          iOS Safari: iOS 10



          Desktop Safari: Jun 2017, so maybe v10.1.1



          So to solve this issue, here is what you can do



          HTML



          <video id="video_player">
          <source id="video_player_source"/>
          </video>


          JS



          const videoPlayer = document.getElementById("video_player");
          const videoPlayerSource = document.getElementById("video_player_source");
          videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
          videoPlayerSource.setAttribute("src","https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
          videoPlayer.load();
          var playPromise = videoPlayer.play();

          // In browsers that don’t yet support this functionality,
          // playPromise won’t be defined.
          if (playPromise !== undefined)
          playPromise.then(function()
          // Automatic playback started!
          ).catch(function(error)
          // Automatic playback failed.
          // Show a UI element to let the user manually start playback.
          );






          share|improve this answer























          • Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

            – Yutong Zhang
            Mar 9 at 9:47











          • Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

            – ravi
            Mar 9 at 15:03












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074055%2felectron-video-cannot-play%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          MediaElement.play() returns a Promise as of version:



          Firefox: 53



          'Chrome for Desktop', 'Chrome for Android', 'Android WebView': 50



          'Opera', 'Opera for Android': 37



          iOS Safari: iOS 10



          Desktop Safari: Jun 2017, so maybe v10.1.1



          So to solve this issue, here is what you can do



          HTML



          <video id="video_player">
          <source id="video_player_source"/>
          </video>


          JS



          const videoPlayer = document.getElementById("video_player");
          const videoPlayerSource = document.getElementById("video_player_source");
          videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
          videoPlayerSource.setAttribute("src","https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
          videoPlayer.load();
          var playPromise = videoPlayer.play();

          // In browsers that don’t yet support this functionality,
          // playPromise won’t be defined.
          if (playPromise !== undefined)
          playPromise.then(function()
          // Automatic playback started!
          ).catch(function(error)
          // Automatic playback failed.
          // Show a UI element to let the user manually start playback.
          );






          share|improve this answer























          • Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

            – Yutong Zhang
            Mar 9 at 9:47











          • Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

            – ravi
            Mar 9 at 15:03
















          0














          MediaElement.play() returns a Promise as of version:



          Firefox: 53



          'Chrome for Desktop', 'Chrome for Android', 'Android WebView': 50



          'Opera', 'Opera for Android': 37



          iOS Safari: iOS 10



          Desktop Safari: Jun 2017, so maybe v10.1.1



          So to solve this issue, here is what you can do



          HTML



          <video id="video_player">
          <source id="video_player_source"/>
          </video>


          JS



          const videoPlayer = document.getElementById("video_player");
          const videoPlayerSource = document.getElementById("video_player_source");
          videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
          videoPlayerSource.setAttribute("src","https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
          videoPlayer.load();
          var playPromise = videoPlayer.play();

          // In browsers that don’t yet support this functionality,
          // playPromise won’t be defined.
          if (playPromise !== undefined)
          playPromise.then(function()
          // Automatic playback started!
          ).catch(function(error)
          // Automatic playback failed.
          // Show a UI element to let the user manually start playback.
          );






          share|improve this answer























          • Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

            – Yutong Zhang
            Mar 9 at 9:47











          • Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

            – ravi
            Mar 9 at 15:03














          0












          0








          0







          MediaElement.play() returns a Promise as of version:



          Firefox: 53



          'Chrome for Desktop', 'Chrome for Android', 'Android WebView': 50



          'Opera', 'Opera for Android': 37



          iOS Safari: iOS 10



          Desktop Safari: Jun 2017, so maybe v10.1.1



          So to solve this issue, here is what you can do



          HTML



          <video id="video_player">
          <source id="video_player_source"/>
          </video>


          JS



          const videoPlayer = document.getElementById("video_player");
          const videoPlayerSource = document.getElementById("video_player_source");
          videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
          videoPlayerSource.setAttribute("src","https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
          videoPlayer.load();
          var playPromise = videoPlayer.play();

          // In browsers that don’t yet support this functionality,
          // playPromise won’t be defined.
          if (playPromise !== undefined)
          playPromise.then(function()
          // Automatic playback started!
          ).catch(function(error)
          // Automatic playback failed.
          // Show a UI element to let the user manually start playback.
          );






          share|improve this answer













          MediaElement.play() returns a Promise as of version:



          Firefox: 53



          'Chrome for Desktop', 'Chrome for Android', 'Android WebView': 50



          'Opera', 'Opera for Android': 37



          iOS Safari: iOS 10



          Desktop Safari: Jun 2017, so maybe v10.1.1



          So to solve this issue, here is what you can do



          HTML



          <video id="video_player">
          <source id="video_player_source"/>
          </video>


          JS



          const videoPlayer = document.getElementById("video_player");
          const videoPlayerSource = document.getElementById("video_player_source");
          videoPlayer.setAttribute("style", `top: 0; left: 0; width: 100%; `);
          videoPlayerSource.setAttribute("src","https://www.html5rocks.com/en/tutorials/track/basics/treeOfLife/video/developerStories-en.webm");
          videoPlayer.load();
          var playPromise = videoPlayer.play();

          // In browsers that don’t yet support this functionality,
          // playPromise won’t be defined.
          if (playPromise !== undefined)
          playPromise.then(function()
          // Automatic playback started!
          ).catch(function(error)
          // Automatic playback failed.
          // Show a UI element to let the user manually start playback.
          );







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 5:37









          raviravi

          521619




          521619












          • Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

            – Yutong Zhang
            Mar 9 at 9:47











          • Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

            – ravi
            Mar 9 at 15:03


















          • Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

            – Yutong Zhang
            Mar 9 at 9:47











          • Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

            – ravi
            Mar 9 at 15:03

















          Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

          – Yutong Zhang
          Mar 9 at 9:47





          Is it possible to set a Chromium policy, AutoplayAllowed, in Electron, so that the autoplay will always succeed even if user does not manually start the playback?

          – Yutong Zhang
          Mar 9 at 9:47













          Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

          – ravi
          Mar 9 at 15:03






          Sorry, i never tried it so i don't know. But as far as i know, Solution I provided will work to autoplay video

          – ravi
          Mar 9 at 15:03




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074055%2felectron-video-cannot-play%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved