Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.*"
share|improve this question
4  
HTML5 support is built into browsers, so no additional process is created. –  depquid Jun 5 '13 at 18:03
1  
might be better asked in webmasters SE. –  mdpc Jun 5 '13 at 19:24
1  
@Radu - "a browser knows how to choose" -- I think you got that the other way around, a browser may support various HTML5 features and it's the other side that detects which features are supported. –  don_crissti Jun 7 '13 at 19:17
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

2 Answers 2

up vote 2 down vote accepted
+25

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.

share|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.

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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