borismus / keysocket

http://smus.com/chrome-media-keys-revisited
Apache License 2.0
382 stars 164 forks source link

Several opened tabs with music #82

Open KELiON opened 9 years ago

KELiON commented 9 years ago

When user have several opened tabs with supported music sites (i.e he listen to music on music.yandex.ru and have opened vk.com), message sent to all tabs. And when I want to start playing at music.yandex.ru, actually it starts on both sites.

I have few thoughts regarding this problem. We can pass callback as third argument to chrome.tabs.sendMessage in this loop and break it when music tab found. It is simple option. More complex option is control audio events somehow and order tabs by last audio events. I.e. when user starts audio player on music.yandex.ru it becomes more prioritized tab and then we sendMessage only to this tab. What do you think? I'm not sure, can we control audio events on page from extension? Any thoughts?

borismus commented 9 years ago

This goes quickly into a fair complex area: media controls in general. I wrote a long blog post about it about a year ago: http://smus.com/remote-controls-web-media/

I'm open to simple, cleanly implemented ideas that will approach the active tab stack implementation. I think this extension is a good candidate to prove the concept.

feedbee commented 9 years ago

Extension should show Page Action icon on the pages it supported to control. First of all it's good to see for the user which tabs are currenly controlled. So, using Page Action user can get possibility to disable tabs he doesn't want to controll manually. Isn't it simple and clean idea?

borismus commented 9 years ago

I don't think that the page action idea is a good one. The real solution needs to be a lot more elegant, something like this: http://smus.com/remote-controls-web-media/

On Tue, Feb 24, 2015 at 11:12 PM, Valera Leontyev notifications@github.com wrote:

Extension should show Page Action icon on the pages it supported to control. First of all it's good to see for the user which tabs are currenly controlled. So, using Page Action user can get possibility to disable tabs he doesn't want to controll manually. Isn't it simple and clean idea?

— Reply to this email directly or view it on GitHub https://github.com/borismus/keysocket/issues/82#issuecomment-75915828.

feedbee commented 9 years ago

If I listen music with (for example) yandex.music.ru in the background tab and surfing social network with media support vk.com (for example), topmost tab will be vk.com, while I want to control yandex.music.ru. While your idea with media stack is very interesting, I think user need to have possibility to choose tab he wants to control manually. And it's a good practice to show user which tab is currently under control. Page action is the way to resolve it both.

borismus commented 9 years ago

The other drawback of page action is that the user won't know which tab is controlled until they navigate to it. I really don't think this is a good solution.

On Wed, Feb 25, 2015 at 10:29 PM, Valera Leontyev notifications@github.com wrote:

If I listen music with (for example) yandex.music.ru in the background tab and surfing social network with media support vk.com (for example), topmost tab will be vk.com, while I want to control yandex.music.ru. While your idea with media stack is very interesting, I think user need to have possibility to choose tab he wants to control manually. And it's a good practice to show user which tab is currently under control. Page action is the way to resolve it both.

— Reply to this email directly or view it on GitHub https://github.com/borismus/keysocket/issues/82#issuecomment-76129000.

feedbee commented 9 years ago

Yes, user won't know which tab is controlled until he navigates to it. But it's the only way to get the knowledge. Currently there is no any way to know what tabs are controlled. If media keys don't work, user can't even figure out, is it related to key binding issue, or just current tab is not recognized to be supported by extension.

I personally was in this situation (Pull Request # 94) and had lost about an hour researching chrome keys binding features until I looked into the code and found roots of my problem.

However, I agree with you that it's not the best solution to resolve current discussing issue – 'Several opened tabs with music'. Does it make sense to create another issue addressing user's (my) desire to know what tabs are controlled? I'll try to contribute if you accept this solution. Thank you for response.

borismus commented 9 years ago

Valera, this sounds good. So the plan would be to show a page action on tabs that are media controllable. There would be two states which would need to be visually reflected in the page action:

  1. capable of receiving media events, and
  2. actively focused (only one tab can be actively focused)

This would also require you to implement a notion of page focus in the extension, so that only one of the tabs gets the events. There would also need to be a stack of tabs to handle the case that the focused tab closes. Maybe clicking the page action on a non-focused tab would manually make it focused.

If you were to do this, that would solve the problem in a pretty good way, I think!

On Thu, Feb 26, 2015 at 12:36 AM, Valera Leontyev notifications@github.com wrote:

Yes, user won't know which tab is controlled until he navigates to it. But it's the only way to get the knowledge. Currently there is no any way to know what tabs are controlled. If media keys don't work, user can't even figure out, is it related to key binding issue, or just current tab is not recognized to be supported by extension.

I personally was in this situation (Pull Request # 94 https://github.com/borismus/keysocket/pull/94) and had lost about an hour researching chrome keys binding features until I looked into the code and found roots of my problem.

However, I agree with you that it's not the best solution to resolve current discussing issue – 'Several opened tabs with music'. Does it make sense to create another issue addressing user's (my) desire to know what tabs are controlled? I'll try to contribute if you accept this solution. Thank you for response.

— Reply to this email directly or view it on GitHub https://github.com/borismus/keysocket/issues/82#issuecomment-76140538.

feedbee commented 9 years ago

It's rather complex task to implement all this at once. Page focus is complex task be itself. So, I implemented simpler part of the scope – page action with enable/disable click handler. Next part is related to page focus subject. I can't promise that I will get the work done, but I'll try. I'll appreciate if you merge my PR and update the extension in the store. May be some text style fixes are desired for my commits, because I'm not very good English writer.

faergeek commented 8 years ago

Is it possible to implement "radio logic" instead of "checkbox logic" for extension activation? So instead of "enable/disable this tab" it should "switch control to that tab".

MrKossmo commented 6 years ago

I've just installed this extension. And it works fine. Except one thing.

I thought about the same thing like topicstarter. This extension should be "off by default". That makes me confused a little. I use multi tab surfing on media sites usually (vk, twitch, youtube). For example, I start music to play, check some another tabs, and go to play game. Tabs priority has changed. While in game, i pressed play/pause once. And few tabs switced its status (twich stream, radiopodcast paused, music from few tabs started or not). It makes me to alt+tab my game (what i don't want to do) to fix problems. Something wierd...

It should be "off by default" is first that i was thinking about. To make it more natural, i want to have possibility to control music, not to have control whole time. I want to control music from "this one" tab, and only. I switch it to control. Launch game. And pressing play/pause/next doesn't ruin few other tabs.

Make it "off by default"

Thanks!

feedbee commented 6 years ago

This task will be done sometime either by me, when I'll have enough time to do it, or by someone else if anyone would like to write the code.

ignat980 commented 6 years ago

Looks like PR #259 solves this issue, looks like a good idea. It also removes the context menu options because of the different flow, but honestly I never even use them.

feedbee commented 6 years ago

It solves a part of the issue. Please, read my comment there. If we would able to create new woking logic that covers the whole issue, it would be great.

DragoCubed commented 5 years ago

any update on this? I really hate it when I press play and it starts playing everything.

ChildishGiant commented 5 years ago

Another solution could be an option to only control a tab if it is the focused tab. I mainly use this extension to play and pause videos on my second monitor when in games, so this would solve my problem.

DragoCubed commented 5 years ago

I would prefer it if it:

I actually uninstalled this extension now that Chrome supports media keys and went to chrome://flags to disable single audio source enforcement (just to tell Google that I don't want enforcement as it should be a user facing option).