Hmm… think I’ve definitely caught the coding bug again over the last couple of days!
I’ve started playing around with adding background music to Plex. Files are selected at random from a directory & played when there’s no music or videos playing. I don’t know whether this is of interest for anyone else, but it’s something I’ve thought would be kinda cool for a while now. I’ve tried to get this working a few times over the years with Python scripts but never seemed to get anywhere.
I don’t understand enough about how PAPlayer works yet to add this without breaking things, so I’ve taken the easy way out & added the QTKit framework. I’d love to be able to do it with the built-in, cross-platform player but it seems much more complicated. So far it seems to be working properly - I’ve added settings to enable/disable the music and adjust the background music volume. Until a few minutes ago I WAS getting stuck trying to keep the background music volume relative to the global Plex volume (which was the point of starting the thread), but just had a mid-post epiphany & got it working. The separate volume level for background music still works (e.g. setting the background music volume to 50% means it’ll always be half of whatever the global volume level is).
Still have a few questions though if anyone’s able to help out:
Is there any particular directory I should be using to store the music files in? Currently I’m using Plex/BackgroundMusic under the user’s Application Support directory.
I want to add another option to allow the music to switch over to the theme music for TV shows selected in the library (triggered at the same time as fanart backgrounds). Would GUIWindowVideoNav.cpp be the right place to start looking?
Not really a dev question, but does anyone know of any good free / Creative Commons music I could use? I’ve done a brief search & listened to a few CC tracks but I didn’t find anything that seemed to go well with the MediaStream skin. For testing, I’ve been using a few tracks of the Sky Digital EPG music (http://www.skyepgmusic.co.uk/).
Also, if there’s a stupidly easy way of doing this with PAPlayer that I’ve missed, please let me know!
Hey, very cool, nice job! I think QTKit would be valuable to use to for playing iTunes DRM’d music too, right? We should chat more about how to integrate your changes. Feel free to contact me over email (elan at plexapp dot com).
Yep, that's where I got the idea (and the music I'm currently using) :)
Thanks! Yeah, that's a nice benefit of QTKit - music with iTunes DRM plays with no problems. I'll tidy the code up a bit & send it over. There are probably still a few issues with it - one thing that needs doing is a way of switching the QTKit player to a different audio output if one's been selected in the Plex settings. I don't have a separate sound card so I can't test this myself.
I've got the theme music working now too. There's also support for automatically downloading themes from the internet, although I don't know if that'd be legal, and we'd need someone very generous with their bandwidth to host the files.
It's working okay in my development build - I've put up a short demo video [here](http://www.vimeo.com/1773354). I'm adding support for fading different tracks in & out rather than cutting straight from one to another, but other than that I think it's pretty much finished (unless anyone's got any suggestions).
After that it'll need a bit more testing to work out any bugs make sure it doesn't affect Plex's stability, then hopefully it'll make it into the released builds. The source is on GitHub if you want to try it out sooner though :)
Thanks! I've just been running a build for over 2 hours throwing different music & video files at it without a crash, so I don't think it's having an impact on stability :)
What an excellent demo Jam. The only thing (to my mind) that could better it, is if when changing from tv show section back to home (as an example) the show music would fade out and then the home music would fade back in, rather than a quick snapping off from one track to another.
In my excitement about this addon i tried to get it from Git and compile it but no luck, I’m studying networking so no clue about developing, is there anyway you can host a compiled version somewhere?
Thanks :) I added crossfading last night after I uploaded the video.
I would, but the builds I compile myself refuse to run on computers without all the libraries from MacPorts installed. I'm not very experienced with XCode (or C/C++/Obj-C in general) so I'm at a loss. Can you build the main Plex source without problems?
I haven’t tried to compile the plex versions from Git, I’ve always just waited for the versions to be released. What do you use to compile it with on your computer so i can try it here.
You'll need Xcode 3.1 and a few packages from MacPorts. There are step-by-step [instructions on the wiki](http://wiki.plexapp.com/index.php/How_to_Compile) for getting everything set up. It's a lot of effort to go through for a minor feature though, and you'll have to launch the compiled builds from a Terminal window each time, so you may want to wait until it makes it into a release :)