Start playing a video with sound automatically

103 views
Skip to first unread message

Max Flrn

unread,
Jan 3, 2021, 1:45:25 AMJan 3
to Chromium Extensions
Hi guys.

I want to make an extension to generate a new tab with only a video in it and start playing it automatically like an "alert" type of extension.

I´m thinking about "chrome.tabs.executeScript" and start playing the video with a simple js code line but i don´t know if its a good solution. Also i see that some extensions display a notification with the message "the extension ____ modify this site" so I think maybe with chrome API you can modify some chrome setting to allow videos to "autoplay" but i don´t know how.

Thanks for your time.


guest271314

unread,
Jan 3, 2021, 11:21:01 AMJan 3
to Chromium Extensions, maxg...@gmail.com
What issue are you having implementing the requirement? 

Is playing the audio preceded by user action?

Max Flrn

unread,
Jan 3, 2021, 2:54:09 PMJan 3
to Chromium Extensions, guest...@gmail.com, Max Flrn
That i don´t know how to do it. I think the way is to change the setting to allow videos to autoplay but i don´t know how.

No. My plan is to do it right away when the website is loaded.

Thanks for answer :)

guest271314

unread,
Jan 3, 2021, 3:06:58 PMJan 3
to Chromium Extensions, maxg...@gmail.com, guest271314
I am not sure if those permissions can be changed programmatically after Chrome is running.

The user can lauch Chrome with flags `--autoplay-policy=no-user-gesture-required --disable-gesture-requirement-for-media-playback`.

What is meant by "automatically"?

You can open the new window, if or when user focuses on or clicks the `window` media playback can be commenced using `HTMLMediaElement` or Web Audio API, or other means. 

An example of opening a new `window`, capturing and recording media playback in that `window` https://github.com/guest271314/MediaFragmentRecorder/blob/getdisplaymedia-webaudio-windowopen/MediaFragmentRecorder.html.

bhagyash ingale

unread,
Jan 13, 2021, 12:52:42 PMJan 13
to Chromium Extensions, guest...@gmail.com, maxg...@gmail.com
Reply all
Reply to author
Forward
0 new messages