Chrome* api access from my page js - google-chrome

I want to find out if any tab is playing sound on my webpage. Chrome had chrome.tabs api which tells if a tab is playing any sound. How can I access those chrome apis on my page.

You cannot, unless you make an extension to do that for you.

Related

Embedding a chrome native app into an existing tab with content scripts

I am not so certain this is even the right approach. Essentially, I would like to control some WiFi lights (Milight/LimitlessLED brand) so that I can fade out and fade in lights when videos are played on YouTube, Netflix, and other similar services.
The only way to communicate with the lights is by sending UDP messages, and it seems the only way I can access a UDP socket in chrome is either through a chrome app, or a native app.
Native apps seem better, as I can bundle them along with an extension while I don't seem to be able to do that with a chrome app. But in the examples I've seen in documentation, a portable native app (PNaCl), is embedded into a page using <embed>.
Well, a content script can create an tag, but then how could I load the native app without violating the same origin policy? Or would there be a better solution to what I'm trying to do?
I'd create the embed in a background page. Then have your content script eavesdrop on the event that causes the video to start playing, have it send a message to the background script. Then the background script can control the embed by triggering appropriate events.

chrome.desktopCapture throws an error on "tab" as DesktopCaptureSourceType

I am developing a chrome extension, and my point here is to record a browser tab , like Screencastify chrome extension records the browser tab. I referred desktopCapture , a chrome API which works perfectly for "screen" and "window" as DesktopCaptureSourceType, whereas for "tab" as DesktopCaptureSourceType, it throws an error as
desktopCapture.chooseDesktopMedia: Tab capture is not supported yet.
I have configured the required permissions in manifest.json of my extension. Could anyone suggest me a solution?
P.S : I need to record the chrome browser tab only, am not asking for a screen or window recording
This is a known issue: https://crbug.com/488262
However, you can use the chrome.tabCapture api instead. The downside is that you will have to split your interface between capturing tabs and screens/windows, as chrome.tabCapture doesn't provide an equivalent picker.
Why does Google have two separate screen capture apis? Good question.
The stream object generated by the chrome.tabCapture cant be shared outside the plugin code.
You will have to write the code to share the stream to server within the chrome plugin.

Chrome webview application to load extension

Is it possible to have a webview application for a web page and load extensions in the application?
I have created a frameless wrapper for one of our web pages, so we can hide the chrome header. I am also using the stylebot extension to alter some elements in the page. It works fine inside chrome, but when I run the application the stylebot extension is not loaded.
Any idea how can I add the extension to the application?
Greatly appreciate your help on this
Thanks, Laszlo
A Google chrome extension have to be load in Google Chrome (or Chromium based browsers). The Google chrome extension API is not included in the webview engine.
You can open a frameless window with create method of the Google window API. You should add an handler to browser action click and create a window of with "popup" type and the url you want. It's not exactly what you are looking for but I don't know a better way to do it on Mac. Perhaps some one more familliar with that environement could help you.
An other far more complicated solution is to fork the Crhomium project and do what you want. But it demand a large developpement I think.

Embed web inspector console in a page

Is there any way to embed "console" tab from chrome web inspector in a page?
Unfortunately I do not know of a way to do this in a normal web page in any browser but you could make an Electron app and perhaps show the inspector whenever you want for the user.
If you are looking to embed a JS console emulator on your site, perhaps to show off raw JavaScript, you can use YourJS Console. It also gives you the ability to initialize the console with custom code or a GitHub Gist.

can't click allow button flash microphone access in chrome extentions

I have a chrome extentions to record and upload sound. I embedding some flash content in an iframe to that extention. The flash part is requesting access to the allow the michrophone first. If I open in browser firefox and chrome, it's work proferly. But if open in chrome extentions, allow button is disabled or can't be clicked.
are there any way to fix this?
Thanks......
There are security restrictions embedding flash inside a chrome-extension:// URL, which behaves much like a sandboxed file:// environment. Perhaps you're running into one.
Here are some bug links for you:
http://code.google.com/p/chromium/issues/detail?id=42796
http://code.google.com/p/chromium/issues/detail?id=58909
A potential workaround is to have an iframe point to an HTTP url with the flash content. You can also make an exception in the flash control panel, but that's per machine and probably not what you want.