Giter Site home page Giter Site logo

msfeldstein / chrome-media-keys Goto Github PK

View Code? Open in Web Editor NEW
89.0 5.0 33.0 15.56 MB

Chrome extension that adds media keys to most web music players

License: GNU Affero General Public License v3.0

CoffeeScript 14.03% JavaScript 79.95% CSS 2.81% Haml 3.22%

chrome-media-keys's Introduction

The extension can be installed from the Chrome Web Store here

Building

Ensure grunt-cli is installed on the system

npm install -g grunt-cli

Install the npm packages for this project

npm install # In the project directory

Run grunt

grunt run

If you see a ENOENT error, make sure imagemagick is installed

npm install imagemagick

Adding a new service

If you are the owner of a service, you can implement support directly in your site. This is far more stable. See http://sway.fm/api

  1. Create a new controller. In src/controllers, you can see examples of many existing controllers.

  2. You'll most likely want to copy BasicTemplate.js and fill in the blanks. You won't need values for everything, some fields are redundant. For example you won't need playPauseSelector and playSelector, just one or the other, depending on if the play and pause button are separate elements.

  3. Add controller to src/background/mappings.coffee. This will match the domain of the player to the controller file you just wrote.

That's it.

License

The source files for this extension are made available under the AGPLv3 license. A copy of the text of the license can be found in LICENSE.txt

chrome-media-keys's People

Contributors

adamedgett avatar ashi009 avatar berrberr avatar bibodha avatar csteward-bw avatar cwal avatar dan-lee avatar deathbeam avatar gl0wa avatar igirard avatar inlife avatar jaymo1011 avatar joepvl avatar jonathansadowski avatar mbirth avatar msfeldstein avatar neelance avatar nemchik avatar pandrewhk avatar peterminin avatar radvalentin avatar sj26 avatar skittlepony avatar stansidel avatar therealtbs avatar ustice avatar yfrommelt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

chrome-media-keys's Issues

YouTube not working

I compiled from source using the instrcutions provided. I am running Ubuntu 16.04.5 LTS, kernel 4.15, Chromium 69 from chromium-dev VAAPI PPA. It works for Google Play Music, just not for YouTube videos. Is this fixable? Thanks.

Double handling of media keys

If a site implements its own media keys handling, both handlers are invoked and the key is processed twice. For the Play/Pause key it means that the music is paused and immediately resumed. An example of such a site is radio.yandex.ru.
I think there should be an option in the controllers to disable media keys handling.

free vs paid

Chrome web store has this extension listed as paid. Granted anyone who would bother with git can have it for free (and will hopefully contribute), but I've got a lot of friends who would love to just have the media keys.

Maybe you could consider having a free and paid version. Things like the button with the player controls and album art would be paid features, notifications (once that's ready) could be paid, scrobbling could be paid, etc.

Having multiple tabs of SoundCloud confuses the extension

To reproduce;

  1. Open a new tab with soundcloud and start playing a track.
  2. Open another new tab with soundcloud and start playing a different track. The first tab will pause playback.
  3. View the extension popup and the first tab's song info and album art are still displayed and the popup believes media is paused.

I think this is because soundcloud tries to handle multiple tabs in its own way (passing the player from tab to tab) but im not really sure.

Small Typo in Activity Tracking

I was going over the code to see if I could hook my 'Stop' media key to click the thumbs down button on Pandora, when I noticed this small typo. Note 'isntallId' on line 13 of the background script.

12 | trackActivity = (eventName, attributes={}) ->
13 |   attributes.installId = localStorage.getItem('isntallId')
14 |   # Add keen tracking here

Just thought you might want to know.

Dynamic support flags

This may already be implemented, but I haven't found this feature. Is there a way for a controller to determine the availability of buttons like, for example, "thumbs down" dynamically, using a custom function? One service (namely Yandex.Music) has 2 playing modes, one of which has a dislike button, while the other doesn't.

Not recognizing playing tabs in 4.41

Getting this error in the console, and functionality seems to be broken for all sites.

Error in event handler for (unknown): TypeError: Cannot read property 'tabId' of undefined
    at chrome-extension://icckhjgjjompfgoiidainoapgjepncej/popup/popup.js:19:28handler @ extensions::uncaught_exception_handler:8

Controller does not always initialize

See #105; I ran into this while working on #106. At least on my (admittedly slow) machine, the controller isn't consistently loaded before the 500ms window is up, causing init to never complete.

Convert To Basic

There are 20+ non basic controllers as of posting this issue. It might be a good idea to investigate which ones can be converted to basic to make long term maintenance easier. This might be better as a readme or wiki page that can be updated over time as controllers are converted to basic.
Here is a list of all non basic controllers;

BronyTunes
GetWorkDone
Hypemachine
Lastfm
Monstercat
PonyFM
PonyvilleLive
Qriosity
Rbma
Shim (isn't this the Unity API?)
Soundtracker
Sway
Thesixtyone
ThisIsMyJam

list supported controllers

Can you have the grunt run generate a user friendly readable list of controllers?

Or maybe some other way of doing it that's easy for you to maintain.

Possibly include some properties in the controllers like

name: "Last.FM",
url: "http://last.fm/",
status: "beta",
updated: "20150519"

Maybe more, maybe less, whatever helps.

Plex Media Server / Web App

Hi..

The Plex developers FINALLY added Shuffle to their media server, which also works in their webapp.

Any possibility that you might add support for Plex in Sway? :)

Keys:

Space = Play / Pause
down = Volume Down
up = Volume Up
, (comma) = seek back
. (dot) = seek ahead
left = previous
right = next

Notifications

Would be nice to get (optional) notifications when the playing track switches.

Does not recognize new Pandora website

The Media Keys Chrome extension doesn't seem to work with the 'new web experience' Pandora website (yay, repeat and unlimited skips!). It doesn't even think that anything's playing. With the drastic changes Pandora made, that's not unexpected. I just wanted to let you know.

Getting to the new website is very non-obvious. Here are the steps:

  1. Click your email in the upper right corner.
  2. Choose 'Settings,' and then 'Account.'
  3. Click on 'Go to New Site' in the very bottom left corner of the page.

If there's anything else I can do to help, such as providing logs or testing, just let me know.
Thank you for a wonderful extension!

Pandora has stopped working

Media Keys recently stopped working with pandora.com. It simply always reports "There's nothing playing right now" (see attached screenshot). The timeline seems like it would fit the June 20 release of 4.60.
If there's anything else I can do to help, such as providing logs or testing, just let me know.
Thank you for a wonderful extension!

screen shot 2017-06-26 at 7 57 59 am

Media keys break on extension autoupdate

  1. Tab open to music service, media keys working
  2. Extension autoupdate occurs (simulate by unchecking, then checking enable in extensions)
  3. Media keys no longer working

I believe the problem is in the following opening lines of content.coffee

if window.injected then return
window.injected = true;

This means that when the content scripts run again on re-enabling the extension, they don't actually register the tabs, even though this is the first time the extension has run.

This makes the frequency of updates a mixed blessing, as it requires closing all music tabs and re-opening every time it happens.

Support chrome apps

Add support for chrome apps that are wrappers for already compatible sites. Maybe this can be achieved by checking if WindowType is "app" ?

BasicController with Frames

Currently the basic controller doesnt work if the player is in a frame like spotify. I've tried using overrides but it makes the controller pretty complex and kind of defeats the purpose.
Can we add a property for frameSelector ?
If frameSelector is defined in the controller then use something like this document.querySelector(frame).contentDocument.querySelector(element) whenever another selector is trying to get what it needs.

This is a bit of a bigger change so i'll see what I can do about a PR but i'm not really sure about the idea yet.

favorite in last.fm

with scrobbling enabled, would be great to be able to fav the current track in last.fm

Amazon music not working

For a month or two now the Chrome extension Media Keys by Sway.fm hasn't been working with Amazon Music cloud player. There used to be a support tab on the extension page but that has been removed and only Overview, Reviews and Related are left. Before it was removed I noticed a few other users commenting with the same issue. Also Sway.fm doesn't resolved, isn't registered and obviously the support email won't work as a result. The Twitter account is still up at https://twitter.com/swayfm.

Does anyone involved in this OSS project know whether the published plugin is maintained anymore or if there is an alternative that works well?

Thanks!

License

Is it possible to add an open-source license to this project?

I understand if that's not something you'd want to do, but it would make me -- and I assume others -- feel more comfortable contributing.

Amazon Like/Dislike

Amazon has thumbs up and down buttons that could be grabbed for the extension. I tried and couldn't get it working :(

YouTube Music non functional

Hello, I'm a purchaser on the chrome web store and just noticed that there's no YouTube Music support. This is actually a bit of an issue now that Google is pushing everyone off of Play Music to YouTube Music. Please implement support if at all possible. Thank you. ๐Ÿ˜„

SubSonic 6.0 support

Subsonic 6.0 is out and introduced a new HTML 5.0 player. I'll see if I can add this.

Document BasicController

There seem to be a ton of options that aren't laid out in any template or anything. It would be great to have a template and comments about what each property does. Maybe also mention the override capability.

Hopefully this will make it easier for contributors to maintain controllers over time.

Spotify

Hi.

It seems the latest update on the Chrome Web Store, broke Spotify integration, atleast, it ain't working anymore :)

Mixcloud has stopped working

Hello, Mixcloud seems to have stopped working yesterday or the day before. Running 4.61. Sorry I don't have more information what precisely changed!

Doesn't work on linux mint 17

Absolutely does not work with linux mint 17 and chrome version 37.
Detecting music from a playing channel such as Songza, 8tracks doesn't work.
Media keys have absolutely no effect.

Captures media keys even when no usable tab for it: prevents native app from using them

Hey guys,

So this ext is the bomb, thank you so much. Being able to control my Grooveshark instantly from anywhere (Pause/Play mostly) is awesome.

OTOH, I cringe at the flip side of this: apparently you guys capture these keys even when you can't use them. If I don't have any supported webapp opened in Chrome, for instance, they still get sucked by your ext apparently, because iTunes can't seem to use them anymore.

My using iTunes manually (play, pause, etc.) doesn't grab the keys back. I have to close Chrome entirely for this.

I'm on OSX Mavericks with Chrome 39 dev, if that helps.

Any ideas?

Best,

Media Stop Key

I frequently use a macro to send a stop keypress ( VK_MEDIA_STOP or 0xB2 according to https://msdn.microsoft.com/en-us/library/dd375731(VS.85).aspx ) and it would be nice if this extension could support this.

The idea would be the stop key pauses the music, but does not play the music.

I use this functionality kind of like a "boss key" if you will, i press a button and my music stops and some other actions happen as well. This doesnt work if I use play/pause because if i'm not playing music and I hit my "boss key" music will start rather than stop if i use play/pause. I've worked with another media key extension for chrome and was able to implement this functionality but the pull request was never accepted. Before I go digging through the code of this extension I was wondering if this would be easy for any existing contributors to add.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.