Flash player - the JW jeroen wijering player instead of xspf

Announcements and description of general changes in kPlaylist

Still doesn't work

Postby Toy Sun » Sun Mar 09, 2008 4:38 am

Hi
I still can't get it to work - I've really tried all I know how to do (not a programmer at all...)

Can anyone help me get this player to work? It truly is a better player than the xspf player, IMHO.

Thanks!

John
Toy Sun
 
Posts: 19
Joined: Sun Dec 10, 2006 3:47 am

$cfg['xspf_url'] = 'morrow/xspf_jukebox.swf';

Postby bankans » Wed Mar 19, 2008 8:47 pm

Hello,
I can not locate the line:
Code: Select all
 $cfg['xspf_url'] = 'morrow/xspf_jukebox.swf';


It is not there in the SINGLE FILE i downloaded to install Kplaylist. Please help.
bankans
 
Posts: 3
Joined: Wed Mar 19, 2008 8:45 pm

Postby Toy Sun » Wed Mar 19, 2008 11:41 pm

It's not in the original file... read the whole thread to understand that users are creating a /morrow directory and then modifying the basic kplaylist.php file to use the morrow player.

Did you read the whole thread carefully?

thanks

J
Toy Sun
 
Posts: 19
Joined: Sun Dec 10, 2006 3:47 am

Streaming problem

Postby kirax2 » Sun Apr 06, 2008 9:23 pm

Hi folks. I'm trying to get the JW FLV Player working on my installation of kPlaylist. I'm almost there.

I'm using this code that was posted earlier. I commented out the header line for simplicity's sake (so I could look at the source more easily); it doesn't seem to make a difference for this particular issue.

Code: Select all
               $this->data .= '<track>'.$this->crlf;
               $this->data .= '<title>'.$f2->gentitle(array('title')).'</title>'.$this->crlf;
               $this->data .= '<creator>'.$f2->id3['artist'].'</creator>'.$this->crlf;
               $this->data .= '<location>'.$url.'</location>'.$this->crlf;
               $this->data .= '</track>'.$this->crlf;
            }
         }
      }
   }
   function flashhtml()
   {
      global $setctl, $phpenv, $u_cookieid, $u_id, $cfg;
//      kprintheader('', 0, 0);
      $playlist = $setctl->get('streamurl').$phpenv['streamlocation'];
      $playlist .= '?templist='.$u_id.'&amp;c='.$u_cookieid.'&file='.lzero(getrand(1,999999),6).'.xml';
      $link = $cfg['xspf_url'].'?file='.urlencode($playlist);
      ?>
<head>


<script type="text/javascript" src="swfobject.js"></script>


</head>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">
var s1 = new SWFObject('<?php echo $link; ?>','mpl','400','450','7');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('allowfullscreen','true');
  s1.addVariable('height','450');
  s1.addVariable('width','400');
  s1.addVariable('logo','pic.png');
  s1.addVariable('displayheight','300');
  s1.addVariable('autostart','true');
  s1.addVariable('repeat','list');
  s1.addVariable('shuffle','false');
  s1.addVariable("backcolor","0x000000");
  s1.addVariable("frontcolor","0xCCCCCC");
  s1.addVariable("lightcolor","0x996600");
  s1.write('player1');
</script>
      <?php
      kprintend();


My kpconfig.php file includes these lines:
Code: Select all
$cfg['xspf_url'] = 'mediaplayer.swf';

$cfg['xspf_enable'] = true;
// enable xspf? Make sure the URL above works.


The relative urls are intentional, for reasons listed earlier in this thread (the www.site.com vs. site.com issue).

When I set the output of xspf and try to play a file or playlist, a window pops up with the player and the item(s) appear in the player's playlist, but the stream doesn't work. If I change the $link variable to go to a single file, i.e.
Code: Select all
      $link = $cfg['xspf_url'].'?file=http://mysite.org/music/Albums/10,000%20Maniacs/MTV%20Unplugged/12%20-%20Because%20The%20Night.mp3';
then the file loads and plays perfectly. So it is definitely something to do with the stream url. I'm having trouble understanding how the stream url works, so it's difficult for me to diagnose the problem. Can anyone help? I would be really grateful.

Thanks so much,
-kirax2
Last edited by kirax2 on Wed Apr 09, 2008 1:35 am, edited 1 time in total.
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Mon Apr 07, 2008 2:20 am

I've gotten it working now. I'd set on $cfg['filepathurl'] = false; but the value in $cfg['filepathurlprepend'] was incorrect, so it was screwing up the links to all my mp3s; I just didn't realize it at first. :oops:

Now I just need to figure out why my symlinks suddenly stopped working and I'm set!

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

Postby zaqarov » Tue Apr 08, 2008 3:02 pm

Would it be possible to display the album cover instead of the pic.png logo, just by changing php code?
Code: Select all
s1.addVariable('logo','pic.png');


Or would I have to modify the fla/swf ?

zaqarov
zaqarov
 
Posts: 22
Joined: Thu Apr 03, 2008 7:20 pm

complete source for using JW Flashplayer - please!!

Postby Toy Sun » Tue Apr 08, 2008 7:32 pm

Hi,
Ok, I admit I'm not a real coder, but I've definitely spent hours trying different combinations, iterations, etc... and I've kept this thread going (and started it, too :)

Will someone please help me by posting a complete index.php that uses the JW Flashplayer? Every time I paste these code snippets I get "T STRING ERRORS" and I'm sure I'm getting an extra bracket in my code or something, etc... I get a line number, but try as I might, I just can't get this to work.

Very much appreciated.

John
Toy Sun
 
Posts: 19
Joined: Sun Dec 10, 2006 3:47 am

Postby kirax2 » Tue Apr 08, 2008 10:44 pm

zaqarov: The "logo" attribute overlays a logo over the picture while it's playing; it's useful if you have a commercial site and want to "brand" your videos, but not for the private user (I've since removed it from my code). This page displays what a logo looks like in action: http://home5.inet.tele.dk/nyboe/flash/m ... ndlogo.htm

If you want an image to show up in the play window and playlist, the format looks like this:

s1.addVariable("image","cover.jpg");

However, that will always show the same image for mp3 files. If you want to include a different cover that shows up with each file as a thumbnail in the playlist and on the screen during playback, you'll need to find a way to modify the xml file that kPlaylist creates so as to include an image variable for each file.

Hope this helps!
-kirax2
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Tue Apr 08, 2008 10:55 pm

Toy Sun:
I've been messing with my script so much that it's, well, a mess right now. Let me clean up the code a bit and I'll get back to you later today, okay?

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

Thank you!

Postby Toy Sun » Tue Apr 08, 2008 11:05 pm

Totally appreciated!

thanks,

J
Toy Sun
 
Posts: 19
Joined: Sun Dec 10, 2006 3:47 am

Postby zaqarov » Tue Apr 08, 2008 11:32 pm

Kirax2 thanks for your reply,
turns out all I had to do (to display album art in JW FLV player) was not to remove this
Code: Select all
$kpi = new kpimage(false, $f2->drive, $f2->relativepath);
               if ($kpi->find())
               {
                  $kpi->resize();
                  $imgurl = $kpi->geturl(true);
               } else $imgurl = '';
               $this->data .= '<image>'.$imgurl.'</image>'.$this->crlf;
from the original code.

This way, the xml will contain a url to the album art, and JWPlayer will display this image, both next to the trackname and in the large viewer on top.

Next, I had kplaylist resize all album art to 300x300, I set the displayheight variable of JWplayer to 300 and played around with the default height and width of the xspf window.

Still one question though, slightly off-topic, but not entirely: how would I go about making the popup window non-resizable? I can't find the js code that spawns the window in the php script.

zaqarov

EDIT:
screenshot :)
Image
zaqarov
 
Posts: 22
Joined: Thu Apr 03, 2008 7:20 pm

Archive of working JW Player

Postby kirax2 » Wed Apr 09, 2008 1:11 am

Toy Sun:

Here is a plain vanilla install of the latest build (485) modified to work with the JW Player. This currently doesn't include the album art mod mentioned by zaqarov because I haven't gotten it to work yet.

First: Make sure that the mediaplayer.swf file and the swfobject.js file from the JW Media Player download are in the SAME directory as the kplay.php file.

Second: Make sure you put the appropriate information for your server on lines 68-72 (obviously ^_~)

Third: Make sure to change the playlist setting in "Options" to "xspf".

Now try it and see if it works.

For those interested, here are the changes in this script:

Line 348: $cfg['xspf_url'] = 'mediaplayer.swf';
(I did not use an absolute url as I had some of the same problems with resolving the path (www vs. no www) as mentioned earlier in this thread. YMMV however, and if you still have problems, I recommend trying the full url here.)


Line 351: $cfg['xspf_enable'] = true;

Line 344: $cfg['window_x'] = 500;
Line 345: $cfg['window_y'] = 500;

This gives you a HUGE popup window for the player. I made it this large to facilitate experimenting with different sizes, however, you'll probably want to trim it down a little for your installation.

And finally,
Code: Select all
               $this->data .= '<track>'.$this->crlf;
               $this->data .= '<title>'.$f2->gentitle(array('title')).'</title>'.$this->crlf;
               $this->data .= '<creator>'.$f2->id3['artist'].'</creator>'.$this->crlf;
               $this->data .= '<location>'.$url.'</location>'.$this->crlf;
               $this->data .= '</track>'.$this->crlf;
            }
         }
      }
   }
   function flashhtml()
   {
      global $setctl, $phpenv, $u_cookieid, $u_id, $cfg;
//      kprintheader('', 0, 0);
      $playlist = $setctl->get('streamurl').$phpenv['streamlocation'];
      $playlist .= '?templist='.$u_id.'&amp;c='.$u_cookieid.'&file='.lzero(getrand(1,999999),6).'.xml';
      $link = $cfg['xspf_url'].'?file='.urlencode($playlist);
      ?>
<head>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">
var s1 = new SWFObject('<?php echo $link; ?>','kplayer','400','400','8');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('allowfullscreen','true');
  s1.addVariable('height','400');
  s1.addVariable('width','400');
  s1.addVariable('displayheight','175');
  s1.addVariable('autostart','true');
  s1.addVariable('showstop','true');
  s1.addVariable("backcolor","0x000000");
  s1.addVariable("frontcolor","0xCCCCCC");
  s1.addVariable("lightcolor","0x996600");
  s1.addVariable('javascriptid','kplayer');
  s1.addVariable('usefullscreen','true');
  s1.addVariable('shuffle','false');
  s1.write('player1');
</script>
      <?php
      kprintend();


I used the displayheight variable to demonstrate that you can have both a movie screen and a list of what's playing showing. It took me awhile to figure out how the displayheight variable worked, so I'll try to explain it as best I can. If the displayheight is greater than or equal to the height variable, the player will appear to be all movie screen. When moused over, a control bar will appear, and when the mouse is removed the control bar fades. If the displayheight is set to less than the height variable, the following things will happen:

If the displayheight is 20 pixels less than the height, you'll get a movie screen with a control bar at the bottom.

For each additional 41 pixels you lower the display height, you'll lose that much off the movie screen height and gain an item on the play list.

For example:
s1.addVariable('height','400');
s1.addVariable('displayheight','175');
In this configuration, you will get a player that is a total of 400 pixels in height. The top 175 pixels will be the movie screen. Beneath that you will see a control bar which is 20 pixels in height. And beneath the control bar you will see 5 play list items (41*5=205).
..........Movie: 175
+ Control Bar: 20
+ Playlist item: 41
+ Playlist item: 41
+ Playlist item: 41
+ Playlist item: 41
+ Playlist item: 41
_________________
=Total height: 400

If the displayheight is set to "0", there will be no movie screen, just a control bar and a play list. The control bar will be at the top, 20 pixels high, and each play list item will still be 41 pixels high. So if your height is 225 and your displayheight is 0, you will see a control bar at the top and exactly 5 play list items underneath it ((5*41)+20)=225, and NO movie screen.

You can also do interesting things by changing the width variable, but I haven't really messed around with that.

I hope this helps. I'm sorry it's so long!
-kirax2
Last edited by kirax2 on Wed Apr 09, 2008 1:34 am, edited 1 time in total.
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby kirax2 » Wed Apr 09, 2008 1:28 am

zaqarov: That's pretty freaking awesome! Could you post your code with a little more context (i.e. how it fits into the modified code I posted)? I tried it but it didn't work. ^^;

I'm sorry, I don't know where the code is that spawns the window; I've been looking for that myself! ^^; But my window isn't resizable. What browser are you using? I'm using Firefox.

-kirax2
P.S. You might try putting this into the html; maybe it will help:
http://www.faqts.com/knowledge_base/vie ... /aid/27319
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

Postby zaqarov » Wed Apr 09, 2008 2:03 am

Kirax2,

You should add this:
Code: Select all
$kpi = new kpimage(false, $f2->drive, $f2->relativepath);
               if ($kpi->find())
               {
                  $kpi->resize();
                  $imgurl = $kpi->geturl(true);
               } else $imgurl = '';
               $this->data .= '<image>'.$imgurl.'</image>'.$this->crlf;

below
Code: Select all
$this->data .= '<creator>'.$f2->id3['artist'].'</creator>'.$this->crlf;
(line 3 of your last code snippet - apr 9)

If that doesn't work, this is my entire kpxspf class:
Code: Select all
class kpxspf
{
   // helper tool for flash

   function xml_top()
   {
     $this->crlf = "\r\n";
     $this->data = '<?xml version="1.0" encoding="';
     if (UTF8MODE) $this->data .= 'UTF-8'; else $this->data .= 'ISO-8859-1';
     $this->data .= '"?>'.$this->crlf;
     $this->data .= '<playlist version="1" xmlns="http://xspf.org/ns/0/">'.$this->crlf;
     $this->data .= '<trackList>'.$this->crlf;
   }

   function genxmlfile($uid)
   {   
      $this->xml_top();

      $result = db_execquery('SELECT sid FROM '.TBL_TEMPLIST.' WHERE uid = '.$uid.' ORDER BY rid ASC');
      while ($row = mysql_fetch_row($result)) $this->xml_link($row[0]);   
   
      $this->data .= '</trackList>'.$this->crlf.'</playlist>';

      header('Content-Disposition: attachment; filename=kp'.lzero(getrand(1,999999),6).'.xml');
      header('Content-Type: text/xml');
      header('Content-Length: '.strlen($this->data));
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

      echo $this->data;
   }

   function write($sids)
   {
      global $u_id;
      db_execquery('DELETE FROM '.TBL_TEMPLIST.' WHERE uid = '.$u_id);
      for($i=0,$c=count($sids);$i<$c;$i++) db_execquery('INSERT INTO '.TBL_TEMPLIST.' SET uid = '.$u_id.', sid = '.$sids[$i]);
   }

   function xml_link($sid)
   {
      $f2 = new file2($sid, true);
      if ($f2->ifexists())
      {
         $fd = new filedesc($f2->fname);
         if ($fd->found && $fd->m3u)
         {
            $url = httpstreamheader3($fd->fid, $sid, $f2);
            if (!empty($url))
            {
               $this->data .= '<track>'.$this->crlf;
               $this->data .= '<title>'.$f2->gentitle(array('title')).'</title>'.$this->crlf;
               $this->data .= '<creator>'.$f2->id3['artist'].'</creator>'.$this->crlf;
      $kpi = new kpimage(false, $f2->drive, $f2->relativepath);
               if ($kpi->find())
               {
                  $kpi->resize();
                  $imgurl = $kpi->geturl(true);
               } else $imgurl = '';
               
               $this->data .= '<image>'.$imgurl.'</image>'.$this->crlf;
               $this->data .= '<location>'.$url.'</location>'.$this->crlf;
               $this->data .= '</track>'.$this->crlf;
            }
         }
      }
   }
   function flashhtml()
   {
      global $setctl, $phpenv, $u_cookieid, $u_id, $cfg;
      kprintheader('', 0, 0);
      $playlist = $setctl->get('streamurl').$phpenv['streamlocation'];
      $playlist .= '?templist='.$u_id.'&amp;c='.$u_cookieid.'&file='.lzero(getrand(1,999999),6).'.xml';
      $link = $cfg['xspf_url'].'?file='.urlencode($playlist);
      ?>
<head>


<script type="text/javascript" src="swfobject.js"></script>


</head>
<p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">
var s1 = new SWFObject('<?php echo $link; ?>','mpl','300','500','7');
  s1.addParam('allowscriptaccess','always');
  s1.addParam('allowfullscreen','true');
  s1.addVariable('height','500');
  s1.addVariable('width','300');
  s1.addVariable('logo','pic.png');
  s1.addVariable('displayheight','300');
  s1.addVariable('autostart','true');
  s1.addVariable('repeat','list');
  s1.addVariable('shuffle','false');
  s1.addVariable("backcolor","0x9e9e9e");
  s1.addVariable("frontcolor","0x333333");
  s1.addVariable("lightcolor","0x555555");
  s1.write('player1');
</script>
      <?php
      kprintend();
   }

}

I noticed a couple of differences in SWFObject variables between your last code post and my code, but these shouldn't matter as long as you don't put an 'image' variable in there (will probably interfere with the xml 'image' tag).
What I basically did to get my JW FLV player working to the point where I am now, was apply the steps from Hefeslug's post on Jan 26, 2008, but since he removed the lines that create the <image> tag in the xml, I put those back.

Of course xspf has to be enabled, pointing to mediaplayer.swf etc, album art has to be there obviously.

EDIT: I'm using safari btw, and it is indeed a browser issue. When I tried on Firefox, the popup window was not resizeable. Should've checked that of course. :oops:

hope this helps
zaqarov
zaqarov
 
Posts: 22
Joined: Thu Apr 03, 2008 7:20 pm

Postby kirax2 » Wed Apr 09, 2008 2:26 am

zaqarov wrote:Kirax2,

You should add this:
Code: Select all
$kpi = new kpimage(false, $f2->drive, $f2->relativepath);
               if ($kpi->find())
               {
                  $kpi->resize();
                  $imgurl = $kpi->geturl(true);
               } else $imgurl = '';
               $this->data .= '<image>'.$imgurl.'</image>'.$this->crlf;

below
Code: Select all
$this->data .= '<creator>'.$f2->id3['artist'].'</creator>'.$this->crlf;
(line 3 of your last code snippet - apr 9)


w00t! That's got it!

I've uploaded a new version of the script that includes the image mod. Get it here:
http://www.sdfo.org/play/kplay2.zip

It's identical to the other one except it includes the lines mentioned above.

Thanks so much!
-kirax2
P.S. Yeah, I tried to weed out some of the flashvars to simplify things for people. Forgot javascriptid, though. Doh! ^^; Does your album art get squished on the play list thumbnails, too, or does your resize take care of that? I may have to set thumbsinplaylist to false just because I find the squishing kind of disturbing... ^^;;;
kirax2
 
Posts: 47
Joined: Tue Apr 01, 2008 1:42 am

PreviousNext

Return to Announcement



cron