I would like to find a command-line or a script that will show me if HTML5 player is running or not in a browser (firefox or chromium).

For example, to determine if Flash player is running in a browser, I use next command:

pgrep -lfc ".*((c|C)hrome|chromium|firefox|).*flashp.*"
  • 4
    HTML5 support is built into browsers, so no additional process is created. – depquid Jun 5 '13 at 18:03
  • @depquid Must to be an event or something that can be catched in this sense... Otherwise how knows a browser to manage this? – Radu Rădeanu Jun 5 '13 at 19:13
  • 1
    might be better asked in webmasters SE. – mdpc Jun 5 '13 at 19:24
  • 2
    What is it that you are trying to accomplish? Using Firefox, it may be possible to write JavaScript code to run in FireBug or Greasemonkey to make the detection on specific sites. But once you can determine whether Flash or HTML5 is being used to play a video, what will you do with this information? – depquid Jun 10 '13 at 21:34
  • 2
    @Radu so I guess you need an anti DPMS/screensaver measure. Ok. try that gem on for size and post feedback. That is for GNOME 3 as per the title. If not, post what Window Manager you are using ... – Alexandru-Florin Vintiloiu Jun 12 '13 at 13:12

I don't see how this would be feasible given HTML5 support is typically built into the browser directly, whereas, Adobe Flash is a plugin. You can see what is a plugin in Chrome by browsing to the "chrome:plugins" page.

For example you can see the Adobe Plugin from my Chrome browser.

          ss of plugins

HTML5 on the other hand doesn't have any corresponding plugin, so you won't see a process getting forked from Chrome when it's dealing with this type of content.

| improve this answer | |
  • As I said there isn't any way that I can see to determine this via the command line. The code for the HTML 5 "player" is embedded directly into the browser so there is no process that will show up in a ps. – slm Jun 8 '13 at 7:40

This question is not necessarily solvable using the command line (as you seem to want to do). No forking happens, the player runs inside the process that handles this exact webpage, making it impossible to check through ps.

However, the solution is accessible by the means of the website source code. The following solution may work:

$ curl http://example.com/ | grep '<video'

Note that the website is likely to be using scripts to place the player and you need to use Firebug or the WebKit Inspector to access live website code and search for the video tag there.

And for YouTube, alternate solution is looking for "html5": true in the source code, but HTML5 on YouTube would require authentication, which is hard to do with curl.

| improve this answer | |
  • This answer is most approached about what I need. If you can make that curl to use the URLs which are opened in browser, I will gonna give you the bounty if a better solution will not appear. – Radu Rădeanu Jun 8 '13 at 10:54
  • 1
    @Radu That’s impossible, unless you hack the browser (alternatively, write an extension). Or use wireshark, or another tool for sniffing TCP packets. And that isn’t easy to do. Read up the docs yourself. – Chris Warrick Jun 8 '13 at 17:42

It does not directly accomplish what's asked, but perhaps something to the same effect (actually broader in scope) could be achieved by grepping for potential HTML5/flash player site names on a pipe of "wmctrl -l", combined with the detection of sound.

if wmctrl -l | grep -i "youtube\|vimeo\|etc" && \
grep RUNNING /proc/asound/card*/pcm*/sub*/status ; then 
echo "some media-site is possibly playing something. 
At least the OS is playing something and some video
site is on the top tab on some browser" ; 
echo "there may well be some HTML video going on 
in some browser, but it's either not on the top tab
or not playing audio, so..."
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.