Browse files

Make jPlayer aware of which stream format is set

Previously jPlayer was set to stream only mp3 by default. This defers
the initialisation of jPlayer until the server status object is ready,
then sets the format appropriately. This was previously causing ogg
streaming to fail silently.
  • Loading branch information...
1 parent 5a60afd commit 87330aca15aa0b6e2f904ec8ebf2977beb4656bf @davidbanham committed Apr 3, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 src/client/
@@ -1256,6 +1256,13 @@ handleResize = ->
$pl_header = $pl_window.find("#playlist .header")
$playlist_items.height $pl_window.height() - $pl_header.position().top - $pl_header.height()
+initjPlayer = ->
+ $jplayer.jPlayer
+ swfPath: "/vendor/Jplayer.swf"
+ preload: "auto"
+ supplied: server_status.stream_httpd_format
+ solution: "flash, html"
$document.ready ->
socket = io.connect()
@@ -1287,6 +1294,7 @@ $document.ready ->
+ initjPlayer()
window._debug_server_status = server_status
if (user_name = localStorage?.user_name)?

3 comments on commit 87330ac

Thanks for reporting this issue and making a fix.

Couple things:

  1. Use 2-spaces, not hard tabs
  2. the jplayer.jPlayer constructor is duplicated at the bottom of the file in document.ready. Let's only have one call to the constructor.
  3. Let's only change the 'supplied' option to jPlayer in the status update, since that's the only thing that is potentially changing. If that is required in the constructor, let's delay constructing jPlayer until the first status update and then not do it again.

I got lazy with supporting ogg in groovebasin streaming since there is an unsolved mpd bug limiting the quality of the stream right now. The bug report is waiting on me for something though, so I'll get on that.


davidbanham replied Apr 3, 2012

  1. Cool. Vim's automagical indenting has blinded me to what I'm actually using.
  2. I meant to delete that second constructor. I made these changes in javascript then ported them back to coffee, missed that bit.
  3. As per 2. It's required in the constructor, but the constructor in document.ready shouldn't exist.

Will resubmit in a sec.


davidbanham replied Apr 3, 2012

Here we go:


Please sign in to comment.