Jump to content
php.lv forumi

mp3 player


ziedinjsh

Recommended Posts

Sveiki!

 

Vai ir kaut kur dabonāms kaut kāds mp3 playeris ko ievietot iekš portāla kurš mp3 failus lasa no norādīta foldera?

 

Maiģināju JW playeri ar to playlist ko ģenerē php, bet nekā neizdevās.. varb;ut ie kāds parasts playeris kur uzreiz lasa no kāda foldera parāda arī playlist?

Link to comment
Share on other sites

skatījos, jā. Tur ir topiki kur ir ķipa gatavs scripts, bet ieejot viņa tur tikai var redzēt pateicīgas atbildes.. kkādi daži ir peejami arī, bet citiem viņi iet, bet man nē!

 

Tad meklē problēmu, kāpēc neiet. Kādi paziņojumi rādās, kāda php versijas. Varbūt tev nemaz nav php? :))

Link to comment
Share on other sites

Tātad php ir šāds:

<?php
$dir = "upload/uploads";
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file !='..'){
$string = "$file";
$new_string = preg_replace("/[^a-zA-Z0-9-.()\s]/", " ", $string);
$new_string = str_replace(".mp3", " ", $new_string);

if (isset($_GET['playlist'])) {
echo '
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>';
while (false !== ($file = readdir($dir))) {
   if($file!='.' && $file!='..' && $file!='index.php') {
   echo "<track>";
   echo "<title>".$file."</title>";
   echo "<location>".$dir."/".$file."</location>";
   echo "</track>";
}
  }
  echo '</tracklist>';


  exit();

}

playera kods:

echo'<center>
<embed 
src="/misc/player.swf" 
bgcolor="#FFFFFF" 
type="application/x-shockwave-flash" 
pluginspage="http://www.macromedia.com/go/getflashplayer" 
allowfullscreen="false" 
flashvars="file=index.php?playlist&
showdigits=true& 
playlistsize="20"
width="510" 
height="404"
>
</center>';

 

playlist izvada:

Warning: readdir(): supplied argument is not a valid Directory resource in /home/produc/public_html/mp3/index.php on line 51

un playeris rāda:

This playlist is not a vaild XML File

Edited by ziedinjsh
Link to comment
Share on other sites

tajā php daļā ir gan kods kas lasa no foldera un rāda lapā un arī playlist generator.. tas viss atrodas index.php un playeris arī ir index.php

 

playerī man ir norādīts flashvars="file=index.php?playlist

 

Bet nu kā jau rakstīt.. playlist man rāda worning un playeris saka, ka nav xml fails

Link to comment
Share on other sites

tajā php daļā ir gan kods kas lasa no foldera un rāda lapā un arī playlist generator.. tas viss atrodas index.php un playeris arī ir index.php

 

playerī man ir norādīts flashvars="file=index.php?playlist

 

Bet nu kā jau rakstīt.. playlist man rāda worning un playeris saka, ka nav xml fails

 

Tad iznes to xml veidotāju ārpus tā index faila uz citu, vai ta tas tik grūti?

Link to comment
Share on other sites

labi.. izdar;iju tā..

playlist.php:

<?php
echo '<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>';
$dir  = opendir("upload/uploads");
while (false !== ($file = readdir($dir))) {
   if($file!='.' && $file!='..' && $file!='index.php') {
   echo "<track>
		<title>".$file."</title>
		<location>upload/uploads/".$file."</location>
</track>";
}
  }
  echo '</tracklist>';
closedir($dir);
?>

atverot playlist.php rādās

upload/uploads/iremember.mp3 upload/uploads/in wild.mp3 utt

bet playeris turpina rādīt to pāsu kļudu

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...