devsnd / cherrymusic

Stream your own music collection to all your devices! The easy to use free and open-source music streaming server.
http://www.fomori.org/cherrymusic
GNU General Public License v3.0
1.03k stars 187 forks source link

Ogg and iOS #443

Open pdb5627 opened 10 years ago

pdb5627 commented 10 years ago

I am brand new to CherryMusic and trying to get it running on a Linux server to serve up music to an iOS7 device. I turned transcoding on and am getting mp3 and flac files to play fine, but ogg files are not playing. In the web client, the play button goes gray but the progress bar doesn't indicate playback starting at all. If I set the user bitrate setting to Medium rather than Unlimited, then it does play just fine.

My guess is that when the bitrate is not being changed, the server is sending an ogg file and not transcoding it to mp3 for the iOS Safari browser. I guess I can work around it by using the bitrate setting, but I'd rather not give up the bits if I don't have to, and I thought maybe the server could know that the iOS browser can't handle ogg and transcode it automatically. I'm not sure how that magic would happen, but there already seems to be quite a bit of great magic built in, so it's worth a shot.

devsnd commented 10 years ago

Hi @pdb5627, sorry for the long wait and thanks for your report!

If I set the user bitrate setting to Medium rather than Unlimited, then it does play just fine.

This is because setting the bitrate in the options menu forces all tracks to be transcoded; most of the time MP3 is chosen since it is supported on most platforms.

My guess is that when the bitrate is not being changed, the server is sending an ogg file and not transcoding it to mp3 for the iOS Safari browser. I guess I can work around it by using the bitrate setting, but I'd rather not give up the bits if I don't have to, and I thought maybe the server could know that the iOS browser can't handle ogg and transcode it automatically

I think that's a pretty good guess! Anyway, if the iPhone is not capable of playing OGGs, they will have to be transcoded, so there in that case you will lose some bits anyhow. However, normally this should happen automatically as you said.

I don't have an iPhone to test this out properly, but I'd like to try a shot in the dark. I've created a new branch which includes the newest release of jPlayer (the library used to play back audio on the client), which might fix the issue. It all depends on jPlayer detecting the playback capabilities of the browser correctly and if this doesn't work, we'll have to create a workaround (or patch jPlayer ourselves).

You can either download it as zip, unpack it somewhere on your server and try it out: https://github.com/devsnd/cherrymusic/archive/jplayer26.zip

or if you're using git, you can simply git checkout jplayer26 inside your cherrymusic repository.

please make sure to clear the cache of the iPhone to make sure you're really using the new version of jPlayer.

:phone: :notes:

pdb5627 commented 10 years ago

Thanks for checking on that issue. I tried the jplayer26 version and did my best to make sure the javascript was reloaded on the iPad, but the ogg still fails to play unless the medium bitrate is used to force transcoding. Thanks anyway!

devsnd commented 10 years ago

Do you know if it worked properly on iOS6? We could check the user-agent of the browser to force transcoding of OGGs for safari on iOS7. Also, could you tell me the user agent of your device? It is visible in the console of the running server for each request.

pdb5627 commented 10 years ago

I do not know if it worked on iOS6. The user agent reported by the server is AppleCoreMedia/1.0.0.11D167 (iPad; U; CPU OS 7_1 like Mac OS X; en_us).