chrome extension: how to mute all audio from certain tab - javascript

I have been searching for something in chrome extension reference to find anything that would allow me to manipulate audio level of a tab. Only option that has come to my mind is make script have it go through all elements in page and either remove them or mute them if possible.
But i feel there has to be a way to reroute all audio streams to nothing, like break them from output which is speakers if using audio api of html5...however no avail either with chrome extension apis or web audio api.
Goal: mute all sounds on page (flash, audio element, etc.)

You cannot do this now, although this will hopefully change in the near-term future.
At the moment, there is nothing in the Chrome APIs, although I did propose a tabaudio API back in February (and am working on a new draft -- as well as an implementation -- right now.)
Can you give me an idea as to what you want this functionality for? (They ask for potential uses when proposing APIs.)
Perhaps the closest that you can do is something similar to what the MuteTab Chrome extension does (written by me, http://www.github.com/jaredsohn/mutetab), which basically scans the page for object, embed, audio, video, and applet tags and hides them from the page. Unfortunately, this misses web audio. Also, instead of muting, it "stops" it by removing it from the page, which could block the video or game associated with the sound. Alternatively, if you just care about HTML5 video or audio or Flash that has an API (such as YouTube), you could could use JavaScript to pause or mute things.

There's now a Chrome extension allowing to mute websites by URL using blacklist/whitelist approach called "Mute Tabs by URL".
It does require you to allow it to read your 'browsing history', but description swears that it doesn't store your URLs anywhere, and event points to a location of source code, so you can verify it for yourself

Related

How to hide audio source in viewpage source just like spotify or soundcloud does?

I am making a music player using javascript but want to hide the music source in the view page source code. How do I make sure that no one is able to download the EXCLUSIVE music?
Thanks !
The short answer: You simply cannot! On the internet everything is freely accessible.
The long answer: All you can do is make it pretty hard for someone to get to that information. This can be done by code obfuscation (Try https://obfuscator.io/) and hiding the information, so it is not obviously visible. (Some websites add enough whitespace at the top of their source code, so if the source code view is opened by a non expert, it looks like it is empty.) But any expert with enough time and effort will find the content in the end.
If someone uses the network tab in the browsers developer tools (CTRL + SHIFT + I), the incoming and outgoing requests are visible. There are even more sophisticated network sniffers, like Fiddler or Wireshark, which offer to save packages to the harddisk.
Some modern streaming websites provide the content with streaming servers, which makes it a little bit harder to get the streamed content, but even that is possible, by downloading all the chunks and combining them. (Even content poisened with DRM can be downloaded, by just playing it and recording the screen.)

Preventing user to see video URL in HTML?

I have an web page where users can view videos.
But the problem is when I inspect the page, it shows the video url.
So is there any idea how we can hide video source like youtube and other videos portal ?
There is no way to hide the video URL entirely without resorting to browser plugins. You can obscure it though, but in most cases they won't be worth it.
Using Media Source Extensions you can deliver segments of video data using obscured urls. And the URL won't be immediately visible in the source of the page. This is similar to what Youtube or Netflix does but requires massive engineering work on the backend. This is also the technique used to play MEPG-DASH with e.g. dash.js or shaka-player.
Set it using Javascript, so it's not viewable with view source, it won't help with inspecting though.
If your issue is people copying the stream URL and using it in their own players, then you might look at protecting it with some sort of tokens security. This is supported by almost any CDN out there, and there are plenty of open source systems to do it in most programming languages.
Lastly, if the issue is that you don't want anyone to copy the content, you can apply DRM protection. One of the easiest and straightforward ways to get started with that, might be using Azure Media Services.

javascript to discover .flv url from any embedded flash video?

Is there any javascript library out there that can find the url to the flash video file (.flv) on current page where it has an embedded flash video player? Ex. opens collegehumor.com video link, shows flash video url.
I have been looking through codes from chrome extensions which discovers flash video links for download but no dice.
Browser extensions can look into Flash internals and monitor your HTTP activity to see where data is being pulled from, however Javascript running in the document does not have permission to read either of those.
Some Flash apps expose some of their internals to Javascript, but they need to specifically write in that functionality, and for third parties this would be documented, presumably as an API. As far as I can tell, collegehumor doesn't provide any of that.

Can I play iTunes song previews in an HTML page?

I need to show on my site search results from the iTunes Store, including previews of audio tracks.
I could use the iTUnes search api to return JSON info with cover image, title and other info. But for previews url I have problems (like following http://a5.mzstatic.com/us/r1000/007/Music/2f/18/8c/mzm.dsmmvsnn.aac.p.m4a).
It is not direct link to file but to some streaming server (not sure it is RTSP, network sniffer shows some other). It could not be dowloaded directly by browser, flash and HTML5 players don’t support it, and it couldn't be opened even using QuickTime Player. So I haven't found any way to embed it to site web page like I do for regular audio/video links.
The only program that could open such urls is iTunes. But as far as I could see it couldn't be used as embed/object in browser/web page.
Any ideas how it could be implemented?
As far as I understand iTunes not allows previews to be played for countries with no iTunes store.
So preview plays in Itunes application and not in quick time or any other player. So such case really difficult to catch (if it will not play in itunes app it will be clear and easy to detect, but in this case not).
After using proxy or just testing from other location all become working. And could be integrated using many flash players.

catching a file when it arrives in the browser

Im working on a video player at the moment (a flash one). Before the video starts, the player receives a manifest.f4m file. I would like to detect WHEN this file is requested and WHEN it actually arrives (ie the time for the server to generate it). I really have NO idea how to do it, but it should be possible using javascript because Firebug and even Google Chrome's console timeline are able to detect this "event".
Do you have any clue ?
Since it's in Flash, Firebug may not pick it up in the Net tab since those calls don't go through the browser's API. You may consider using Fiddler. It will show you just about everything.

Categories

Resources