Opened 16 years ago

Last modified 16 years ago

#4222 closed enhancement

Update MythMusic to continue playing in the background after exiting it. — at Version 21

Reported by: paulh Owned by: paulh
Priority: minor Milestone: 0.21
Component: mythmusic Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description (last modified by paulh)

This is a preview patch that I would like anyone who is interested in this feature to test and provide some feedback.

It allows you to start a playlist playing in MythMusic then exit and use other parts of myth while continuing to play music in the background.

When you exit the MythMusic playback screen you are given the option to exit and stop playing or exit and continue playing. If you choose to continue playing you can then use other parts of Myth while your music is still playing.

When a new track starts and you are not in the main music playback screen a mini popup player is shown for a few seconds then disappears. While the mini player is on screen you can press Escape to remove it or press SELECT and it will stay on screen until you press escape. There is also a new jump point that will instantly show the mini player anywhere in Myth except when playing tv/video etc. While the miniplayer is on screen you can use most of the key bindings available in the main playback screen to change tracks, fast forward, rewind, pause, stop, mute the audio, increase/decrease the volume etc. Like other part of Myth the miniplayer is fully themeable.

TODO:

CD track playback works but returning to the main playback screen always rescans the CD and starts playing from the first track again rather that continuing where it left of.

Change History (32)

Changed 16 years ago by paulh

Attachment: 4222-v1.patch added

Patch to allow MythMusic to play in the background

Changed 16 years ago by paulh

Attachment: miniplayer_background.png added

This new image should be copied to mythplugins/mythmusic/mythmusic/images/miniplayer_background.png

comment:1 Changed 16 years ago by otto at kolsi dot fi

Tested this with two machines. No problems when applying & compiling patch. So far the miniplayer/background play seems to work very well. Nice work, this is much needed enhancement :) I identified two issues:

  • When miniplayer is closed with esc, there's this line in logs. Not sure if it is related or is nothing to worry about: "Could not find widget to detach"
  • When MythMusic is playing music in the background and MythFrontend is exited, there's a segfault (not that big deal because you are exiting mfe anyway).

comment:2 in reply to:  1 ; Changed 16 years ago by paulh

Replying to otto at kolsi dot fi:

Tested this with two machines. No problems when applying & compiling patch. So far the miniplayer/background play seems to work very well. Nice work, this is much needed enhancement :) I identified two issues:

Thanks for testing.

When miniplayer is closed with esc, there's this line in logs. Not sure if it is related or is nothing to worry about: "Could not find widget to detach"

This is actually harmless. We detach the dialog before its displayed so when the MythDialog? destructor I think tries to detach it again it fails. The virtual keyboard displays the same message as well. There's no point fixing this because that code will be removed if/when things start to move over to the new UI anyway.

When MythMusic is playing music in the background and MythFrontend is exited, there's a segfault (not that big deal because you are exiting mfe anyway).

This is not so good :-(

I don't seem to get any segfault when MythFrontend exits. Any chance you could get a backtrace so I know what area of the code I should be looking at?

comment:3 in reply to:  2 Changed 16 years ago by Mike Rice <mikerice1969@…>

Replying to paulh:

Replying to otto at kolsi dot fi:

Tested this with two machines. No problems when applying & compiling patch. So far the miniplayer/background play seems to work very well. Nice work, this is much needed enhancement :) I identified two issues:

Thanks for testing.

When miniplayer is closed with esc, there's this line in logs. Not sure if it is related or is nothing to worry about: "Could not find widget to detach"

This is actually harmless. We detach the dialog before its displayed so when the MythDialog? destructor I think tries to detach it again it fails. The virtual keyboard displays the same message as well. There's no point fixing this because that code will be removed if/when things start to move over to the new UI anyway.

When MythMusic is playing music in the background and MythFrontend is exited, there's a segfault (not that big deal because you are exiting mfe anyway).

This is not so good :-(

I don't seem to get any segfault when MythFrontend exits. Any chance you could get a backtrace so I know what area of the code I should be looking at?

I tested and it looks like it is working fairly well. I'll put it on my main frontend and give it a bit more workout.

I can reproduce the seg fault on exit. I've attached my log. Hope it helps.

Changed 16 years ago by Mike Rice <mikerice1969@…>

Attachment: gdbfrontend.txt added

comment:4 Changed 16 years ago by dbatt@…

A great enhancement. Seems to work well. Seg faults if hitting "play" on an album folder or artist folder on my combined fe/be, but works ok on playlists or playing the first track within an album. Will try and attach a log of seg fault.

With reference to pause/stopping playback when entering playback of video/tv, It might be nice to provide a choice to instead mute the video/tv audio (if that's possible to do), allowing one to listen to music and watch the TV muted, which some of us like to do, ie, watching sport.

I'll continue to test.

comment:5 Changed 16 years ago by Benoît LORAND <benoit.lorand@…>

Great !!

I have installed it yesterday and it's working properly for me. But it there possible to allow change volume in mythgallery ?

Thanks a lot, there's many time i would like this function.

Changed 16 years ago by otto at kolsi dot fi

Attachment: gdbfrontend2.txt added

comment:6 in reply to:  2 ; Changed 16 years ago by otto at kolsi dot fi

Replying to paulh:

When MythMusic is playing music in the background and MythFrontend is exited, there's a segfault (not that big deal because you are exiting mfe anyway).

This is not so good :-(

I don't seem to get any segfault when MythFrontend exits. Any chance you could get a backtrace so I know what area of the code I should be looking at?

I've also attached frontend backtrace. I'm not sure if it's a proper one, there's not so much info.

Earlier when I tested I only used wireless keyboard. Now I've also used remote/LIRC and there I have problem. I can enable the miniplayer with the remote but after that no normal MythMusic commands get through. Only remote key that miniplayer accepts is ESC. And when ESC is pressed, it is sort of interpreted twice. So miniplayer is not only closed but immediately frontend is also about to be closed (second ESC).

At the same the keyboard is working properly. How to diagnose this further?

Changed 16 years ago by paulh

Attachment: 4222-v2.patch added

Updated patch

comment:7 Changed 16 years ago by paulh

Attached an updated patch.

  • Shutdown and delete the music player in an orderly fashion when exiting MythFrontend - should hopefully fix the segfault when exiting MythFrontend.
  • Fix the segfault when pressing select on an artist or album in the music tree.
  • Add some feed back in the mini player when changing volume, muting, changing repeat mode and shuffle mode.

comment:8 in reply to:  5 Changed 16 years ago by paulh

Replying to Benoît LORAND <benoit.lorand@blorand.org>:

I have installed it yesterday and it's working properly for me. But it there possible to allow change volume in mythgallery ?

The mini popup player will allow you to change the volume anywhere. At the moment the jump point to call the popup doesn't quite work properly because it always takes you back to the main menu.

comment:9 in reply to:  6 Changed 16 years ago by paulh

Replying to otto at kolsi dot fi:

Earlier when I tested I only used wireless keyboard. Now I've also used remote/LIRC and there I have problem. I can enable the miniplayer with the remote but after that no normal MythMusic commands get through. Only remote key that miniplayer accepts is ESC. And when ESC is pressed, it is sort of interpreted twice. So miniplayer is not only closed but immediately frontend is also about to be closed (second ESC).

At the same the keyboard is working properly. How to diagnose this further?

I'm going to have to see if I can reproduce this. My dev box doesn't currently have lirc setup so all my testing was done with a keyboard. The player uses the same techniques as the virtual keyboard so I wasn't expecting any problems using a remote. Anyone else tested it and is using a remote?

comment:10 Changed 16 years ago by paulh

(In [14969]) Allow jump points that don't return to the main menu before jumping.

This adds a new REG_JUMPEX macro to mythmainwindow.h that adds an extra parameter that allows you to indicate whether a jump point should return to the main menu before jumping. It will be used by the jump point that shows the popup mini player in MythMusic.

This requires a 'make clean' and rebuild of the plugins.

Refs #4222.

Changed 16 years ago by paulh

Attachment: 4222-v3.patch added

Updated patch (requires mythtv >= r14969 to be installed)

comment:11 Changed 16 years ago by paulh

Description: modified (diff)

Attached an updated patch. You need to update mythtv to r14969 or later for this patch to compile.

  • Fixes the mini popup player not working with a remote.
  • The jump point to show the popup player now doesn't return you to the main menu before showing it.
  • Fixed the visualizer not working after returning to the main playback screen after playing music in the background. There's a couple of seconds delay before the visualizer catches up with the audio output but thats better than no visualizer at all :-)

comment:12 Changed 16 years ago by Matt Rude <mythtv@…>

I applied the patch today, things went smoothly. Thanks. But I do have a few problems. I have noticed that if I play music while in the menu screens, I loose sound on my recordings once I do decide to watch TV. This happens both when I stop the music before starting the recording or just pressing OK will leave the music playing but show the recording. If I go back to "Play Music" and exit and stop the music TV works fine.

Also I was using "Resume mode" = "Exact" for some long radio recordings and as of the last build that feature no longer works. I have no idea if this patch has anything to do with it, but it's a small price to pay for the new patch.

Thanks -Matt

comment:13 Changed 16 years ago by otto at kolsi dot fi

Tested v3 patch and now remote is working, also exit segfault seems to be gone. Couple of (new?) issues:

  • It looks like if you edit song rating when in miniplayer, the rating is not saved to DB. This works still in main player.
  • Most of the time the Last Play time is not updated to DB.
  • When in miniplayer, the album art image is about right size and it is in right place. But "under" it is the album art area and that is a bit too large, there is extra black bars in both under and right side of the album art image.

comment:14 in reply to:  13 ; Changed 16 years ago by paulh

Replying to otto at kolsi dot fi:

  • When in miniplayer, the album art image is about right size and it is in right place. But "under" it is the album art area and that is a bit too large, there is extra black bars in both under and right side of the album art image.

What resolution are you using and are you using a normal or wide theme?

comment:15 in reply to:  14 ; Changed 16 years ago by otto at kolsi dot fi

Replying to paulh:

  • When in miniplayer, the album art image is about right size and it is in right place. But "under" it is the album art area and that is a bit too large, there is extra black bars in both under and right side of the album art image.

What resolution are you using and are you using a normal or wide theme?

I'm using 1360x768 (native res of my LCD tv) and blootubelite-wide theme. I'll attach a picture that shows the problem. With normal MythMusic player this issue does not exist.

Changed 16 years ago by otto at kolsi dot fi

comment:16 Changed 16 years ago by Bill <cizek@…>

Really sweet patch, Paul.

I've attached a few patches I made to my system on top of v3:

072-musichide.patch - stop background music playback when I switch to watching Live or recorded TV.

073-musicselect.patch - Play the first song of a group if you select an artist or album. Mythmusic used to do this but it's changed in your patch and doesn't work with the miniplayer, anyway. This patch makes it work with the miniplayer.

074-isplaying.patch - isPlaying wasn't initialized in the MusicPlayer? class constructor. This caused problems first time into Mythmusic (specifically, the visualizer would start without any music playing, and the Resume mode was ignored)

Thanks for the patch. This is really cool. -Bill

Changed 16 years ago by Bill <cizek@…>

Attachment: 072-musichide.patch added

Changed 16 years ago by Bill <cizek@…>

Attachment: 073-musicselect.patch added

Changed 16 years ago by Bill <cizek@…>

Attachment: 074-isplaying.patch added

comment:17 in reply to:  16 Changed 16 years ago by paulh

Replying to Bill <cizek@rcn.com>:

I've attached a few patches I made to my system on top of v3:

Thanks for testing and the patches Bill.

072-musichide.patch - stop background music playback when I switch to watching Live or recorded TV.

I've already got this working using a slightly different method. I just send MythEvents? when playback starts and ends. The music player listens out for these events and starts/stops as appropriate. Thanks anyway :-)

073-musicselect.patch - Play the first song of a group if you select an artist or album. Mythmusic used to do this but it's changed in your patch and doesn't work with the miniplayer, anyway. This patch makes it work with the miniplayer.

074-isplaying.patch - isPlaying wasn't initialized in the MusicPlayer? class constructor. This caused problems first time into Mythmusic (specifically, the visualizer would start without any music playing, and the Resume mode was ignored)

I'll apply these to my local tree and hopefully sometime later today I'll roll out a new v4 patch for testing.

comment:18 in reply to:  15 Changed 16 years ago by paulh

Replying to otto at kolsi dot fi:

I'm using 1360x768 (native res of my LCD tv) and blootubelite-wide theme. I'll attach a picture that shows the problem. With normal MythMusic player this issue does not exist.

Thanks for the info. Using your settings I could reproduce the problem. There should really be a wide version of the miniplayer window definition added to the default wide MythMusic theme file but for now I have a simple fix that will allow the default one to work for both. I should have a new patch ready for later today.

comment:19 in reply to:  description Changed 16 years ago by benklop@…

TODO:

Test the Repeat and Shuffle modes are working correctly.

I have been using this patch for a few hours now and can verify that at least shuffle, and i think repeat, is working fine. I have to say that I love this patch and I think I will probably end up using this as my main mythmusic interface and just enter the mythmusic plugin when I need to change my playlist. Thanks!

Oh, a possible thought: it would be cool to eventually use mythmusic visualizations as a kind of screensaver that is activated after sitting in the menu for a certain amount of time. it could be deactivated by any keypress...

thanks again, I am watching with great intrest!

comment:20 Changed 16 years ago by paulh

(In [15019]) This adds two new convenience functions to MythContext that sends PLAYBACK_START and PLAYBACK_END MythEvents? to any listeners. tv_play is updated to send out these events when playback starts/ends.

The new music player will use these events to know when it should stop playing and release the audio output to allow playback of recordings or live tv etc.

Afraid it bumps the plugin api again so a rebuild of the plugins is required.

Refs #4222.

Changed 16 years ago by paulh

Attachment: 4222-v4.patch added

Updated patch

comment:21 Changed 16 years ago by paulh

Description: modified (diff)

Attached an updated patch.

  • Fix Otto's cover art image resize problem.
  • Stop the music player when either live TV or a recording is playing and then restart it when playback finishes. Should also fix Matt's disappearing audio problem after using the music player. This needs MythTV to be updated to r15019 or later for it to work properly.
  • All resume modes should now be working.
  • All repeat modes should now be working.
  • I think all the shuffle modes are working OK.
  • Hopefully fix the star ratings, play count & last play metadata not being saved/synced between the miniplayer and the main player. Still needs testing.
Note: See TracTickets for help on using tickets.