Flash player - the JW jeroen wijering player instead of xspf

Announcements and description of general changes in kPlaylist

Postby kirax2 » Sun Apr 13, 2008 3:42 pm

I think a third option would also work, with even less modification: when the play button is clicked, add the entire xml playlist to the popup player using addItem.
No need to parse and add them as single songs. This way, you won't be able to insert a song in 2nd position, but it will be a lot faster, especially if a lot of songs are in the playlists (refer to jeroenwijering forums, serverside is way faster then clientside javascript)

zaqarov


If this were possible, it would be perfect. However, the jw player unfortunately doesn't support adding playlists, only loading playlists. You can only use addItem with individual songs. That was actually one of the first things I tried. If you read the first few posts of this thread, you'll see the discussion regarding this issue: http://www.jeroenwijering.com/?thread=9995

I suggest requesting the same feature, though, in spite of Mr. AJAX's discouraging replies. I know I have seen others that want the ability to enqueue playlists, and if enough people request it, perhaps Jereon will decide to do it. That would make our lives much easier.

The more I think about it, the more I like the idea of something in the player page which parses the list and adds the items. This would have the advantage that kPlaylist wouldn't have to maintain connection with the player, only the pop up page.

I've requested some more help in the JW Forum (they are extraordinarily kind and helpful there) and perhaps this can be made to work.

-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Mon Apr 14, 2008 3:50 pm

Update: I think I'm very close to a solution. It turned out to be much simpler than I thought. I don't think it will even require too much modification of the kPlaylist source.

I'll keep you posted.

-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby aba » Mon Apr 14, 2008 3:55 pm

kirax2 wrote:Update: I think I'm very close to a solution. It turned out to be much simpler than I thought. I don't think it will even require too much modification of the kPlaylist source.


Sounds very interesting :)
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Nearly there...

Postby kirax2 » Fri Apr 18, 2008 4:34 am

This one should work:

http://www.sdfo.org/play/Pop/Player.html

You can launch the player, add a playlist to it, refresh or reopen the main page, and add a playlist to it again.

I'm looking for a way to combine the two functions in one so that a single button opens the player and adds the songs to it. It's trickier than it sounds. The code that the "Add playlist" function uses checks whether or not the popup window already exists. But if the popup doesn't exist yet (as when the page is first loaded) then the code to test for the popup's existence pops up a blank page instead. So right now the only way to get it to work is to depend on the user to launch the player the first time by clicking on "launch player". I'm looking for a way around that.

The other two hurdles to cover are the fact that the location entries in the xml list will need to be url encoded and then decoded (otherwise the playlist can't be parsed, because of the characters in the stream id url) and adding something to test if the popup is closed.

Still, I am making progress.

-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Sun Apr 20, 2008 5:09 pm

By George, I think she's got it!

If you go to this page: http://sdfo.org/play/Pop/NewPlayer.html you'll be able to launch the player by clicking on the button the first time, and enqueue a new playlist into the existing window by clicking on the button the second time. You'll need to scroll down to see the new additions to the playlist.

To aba and all coders: I need just a little bit of help to make this work completely with kPlaylist. If you have the time and are willing, I'd be grateful if you'd look at the following three suggestions.

1. Please check out the jwplayerInclude.php file here: http://sdfo.org/play/Pop/jwplayerInclude.zip. This is my replacement for the jwplayer class (I tried to integrate it as much as possible into the existing setup, but of course it will probably need further modifications). For build 493, this replaces lines 15319 through 15397.

2. The function that creates the jwplayer will need to be modified. When triggered, it should first check if the player window exists. If it doesn't, jwplayer can be created normally. If it does exist, however, the command to "popuphandle.loadXMLDoc" should be triggered. This is the code from my test page that does this. Of course it will need to be modified to fit into kPlaylist.

Code: Select all
function openPopup(theFile) {
   var url = "PlayPop.php";
   popupWin = open("", "popupWin",  "width=500,height=500" ); //if the player window exists, this will connect to it. If it does not, this pops up a blank window which the next line turns into a player window.
   if( !popupWin || popupWin.closed || !popupWin.createPlayer ) {
      popupWin = window.open( url, "popupWin", "width=500,height=500" );
   } else popupWin.focus();
      popupWin.loadXMLDoc(theFile);
}


3. The last modification involves a change to or replacement for xml_link, which is part of the jwplayer class. The function that loads the xml doc into the player window chokes on unencoded location and image urls (it won't load the xml file because of the equal signs and whatnot). Therefore, if the player window is being popped up for the first time, a normal playlist must be used, BUT if the player already exists, the location and image tags must be urlencoded in the xml playlist, thusly:

Code: Select all
            
$this->data .= '<image>'.urlencode($imgurl).'</image>'.$this->crlf;
$this->data .= '<location>'.urlencode($url).'</location>'.$this->crlf;


With these three modifications, kPlaylist could enqueue new playlists to the JW Player without reloading the player each time. I've done as much as I can on my own, but I don't feel that I understand the code of kPlayer well enough to integrate them into the existing setup properly.

If someone else is willing to take a look at my code and see if they can integrate it based on my suggestions, I would be grateful. I think this would be a terrific addition to kPlaylist.

Thank you,
-Janice
aka kirax2
P.S. Sometimes I'm not good at explaining things. Please feel free to ask for further clarification if anything I've said doesn't make sense. Thanks!
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby aba » Sun Apr 20, 2008 9:05 pm

kirax2 wrote:By George, I think she's got it!

If you go to this page: http://sdfo.org/play/Pop/NewPlayer.html you'll be able to launch the player by clicking on the button the first time, and enqueue a new playlist into the existing window by clicking on the button the second time. You'll need to scroll down to see the new additions to the playlist.


Excellent! My challenge is to create the XML file (link), that is, posting a list to kP of tunes/album before the actual player opens. This should be easy with AJAX. I will be back with more details in a few days. Thanks for a great job! :)

aba
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby kirax2 » Sun Apr 20, 2008 10:04 pm

Sweet! I can't wait!

Just a quick note: You won't have to worry about making the playlist urlencoded if the player isn't open yet. If the player isn't open yet, it will just load the non-encoded playlist directly as usual when the player is created (check the sample popup page and you'll see that I've got the file included as one of the flashvariables). After the player window is queried, if it's already open, that's when we know we'll need a urlencoded playlist that can be loaded with loadXMLdoc.

Just want to make sure that's clear.

Thanks again!
-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Mon Apr 21, 2008 4:01 pm

aba wrote:
Excellent! My challenge is to create the XML file (link), that is, posting a list to kP of tunes/album before the actual player opens. This should be easy with AJAX. I will be back with more details in a few days. Thanks for a great job! :)

aba


One more note: (sorry, I've been thinking about this for two weeks, and it's hard to stop!) if you can't get the link to be generated before the actual player opens, you can have the file load a blank list on initial startup and then load the playlist in it once it's created with popuphandle.loadFile. You'd have to be careful of timing, of course, since you don't want to send a playlist until the player is fully loaded, so you'd have to get the player to send something back to the main page once it's initialized to say "I'm ready", and that would trigger the main page to load the newly-made playlist. *shrugs* It's just another way of doing the same thing, really.

Here's the code of the BlankList.xml I used in some of my testing. It works fine.

Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<playlist version='1' xmlns='http://xspf.org/ns/0/'>
  <trackList>
  </trackList>
</playlist>


-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby aba » Fri Apr 25, 2008 10:50 pm

kirax2 wrote:Sweet! I can't wait!

Just a quick note: You won't have to worry about making the playlist urlencoded if the player isn't open yet. If the player isn't open yet, it will just load the non-encoded playlist directly as usual when the player is created (check the sample popup page and you'll see that I've got the file included as one of the flashvariables). After the player window is queried, if it's already open, that's when we know we'll need a urlencoded playlist that can be loaded with loadXMLdoc.

Just want to make sure that's clear.

Thanks again!
-kirax2


Hey

I've managed to get it working more or stable with FF. IE seems to be harder to break through though. Keep getting the error 'Xmldoc' not defined in the following line:

x = xmlDoc.getElementsByTagName(theTag);

I'll be releasing a version sometime during the weekend for testing.
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby aba » Sat Apr 26, 2008 1:40 pm

kirax2 wrote:Sweet! I can't wait!


It's out. Build 494.

Currently, it's only possible to enqueue by clicking the new button called .. 'enqueue'. The other buttons opens the jw player in the normal way, I did this to separate those two until the enqueue method is good enough. And yes, you have to start the window by also clicking this button.
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby kirax2 » Sat Apr 26, 2008 6:39 pm

w00t! Thank you so much! I'm going to try it out right now!!!

You're the best. ^____^

-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Sat Apr 26, 2008 7:04 pm

It doesn't seem to be working for me. :( I can start the player window in the normal way, but when I select a file and click "enqueue", nothing happens; the song doesn't enqueue. Playing "Selected" reloads the player window as it always has. I'm using Firefox 2.0.0.14. Did I miss a step?

Thanks,
-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby aba » Sat Apr 26, 2008 8:34 pm

kirax2 wrote:It doesn't seem to be working for me. :( I can start the player window in the normal way, but when I select a file and click "enqueue", nothing happens; the song doesn't enqueue. Playing "Selected" reloads the player window as it always has. I'm using Firefox 2.0.0.14. Did I miss a step?

Thanks,
-kirax2


Ahh, sorry, I forgot to mention, it's AJAX based so you'll need to
get the prototype (http://www.prototypejs.org/) and enter it into 'Settings' -> Ajax URL.
aba
Site Admin
 
Posts: 2325
Joined: Wed May 08, 2002 9:19 am

Postby kirax2 » Sat Apr 26, 2008 10:07 pm

Ah, gotcha. I have the prototype, but my url was entered wrong.

And now it works!!! Thank you SO MUCH! It will be delightful to be about to queue up songs on-the-fly. ^_____^ I am really thrilled!

-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby jmelhus » Sun Apr 27, 2008 9:59 am

Hi!

Thank's for a great feature! :)

Only downside about it, is that it doesn't support SSL. Would that be implemented in the future?

Problem is, it wont enqueue new files into the window after is has been loaded. This works fine without SSL...
jmelhus
 
Posts: 128
Joined: Sat Jan 01, 2005 1:10 pm

PreviousNext

Return to Announcement



cron