PHP - Mp3 Plays In Browser But Not Flash Player
For some reason, I can get this file to play in the web browser, but I can not get it to play in my flash player.
File: http://envne.com/music/play.php?id=23156 The file is a file that uses cURL, to load the song from the saved url. I am thinking that it is a cURL thing, because when displayed in my google browser, the load bar doesn't load on my page, but on the link below it does display I use other songs in the same flash player by just linking to a different id number and those songs play fine in the player. Why does this song do this, and others don't? File on the web: http://kickkicksnare.com/wp-content/uploads/2010/05/Like-a-G6-Ft.-The-Cataracs-Dev.mp3 The PHP: $ch = curl_init(); header('Content-Type: audio/mpeg'); curl_setopt($ch, CURLOPT_URL, $row['url']); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_FRESH_CONNECT, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_exec($ch); header("Content-Transfer-Encoding: binary"); header("Content-Type: ".curl_getinfo($ch, CURLINFO_CONTENT_TYPE).""); header("Content-Length: ".curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD).""); curl_close($ch); Similar Tutorialswell.. i have vbulletin 4 forum i try to put video player so if i upload mp4 file so i can play video but sad part is its working only at firefox browser can you help me out .. video code looks like this
<vb:if condition="$attachment[attachmentextension] == mp4"> pls i really want that put to work in every browser sadly it works only in firefox somehow.. Hello,
I have been looking for a way to track the play stats on audio mp3's in the admin of my custom post-type. Whatever I google seems to come up with nothing. I not very versed in audio player code - could someone please point me in the right direction.
Again:
I have a custom post-type which uses the wordpress default audio.
I would like to get the number of plays for each audio file and display that in the admin column for my custom post-type
Thanks,
Drew
Hi, i have the following code: where i want the sound to only play during the false part of the IF statement but currently it always plays on every reload, and even if the IF = true any ideas? ive tried autoplay="0" also
Thanks
<embed src="beep.wav" autostart="false" width="0" height="0" id="sound1" enablejavascript="true"> + <script> function PlaySound(soundObj) { var sound = document.getElementById(soundObj); sound.Play(); } </script> + if( isset( $json['Data'] ) ){ echo "<b>Success</b>"; echo "</br>"; echo $data.' x ' .$tqty; echo "</br>"; } else { echo "Error"; echo "</br>"; echo $json['Message']; echo '<script> PlaySound("Sound1"); </script>'; }
Hi to all gurus, Here is a small program in flash which calls values from PHP and displays them correctly. path = "http://localhost/xampp/nwjv/php/"; //declare path to php files lvOut = new LoadVars(); //create lv object sending variables OUT to php lvIn = new LoadVars(); //create lv object receiving variables IN from php lvIn.onLoad = function (success) { if(success) { //PHP variable value to textbox InVal = lvIn.returnVal; InTxt = lvIn.retVal; output.text = InVal; output1.text = InTxt; /* output1.text = "No Value"; if(InTxt == 'lo' ) { output1.text = "Low Value"; } if(InTxt == 'hi') { output1.text = "High Value"; } */ }else{ //...or notify of failure output.text = "fail"; } } myBtn.onRelease = function(){ //assign user-input value to lv property called years lvOut.years = years.text; //send to a blank window // lvOut.send(path + "dogyears_new1.php",lvIn,"GET"); lvOut.sendAndLoad(path + "dogyears_new1.php",lvIn,"GET"); }; can anyone tell me whats this player and the settings for playing mp3 files with this player thanks http://img146.imageshack.us/i/84129977.jpg the below works in firefox but doesn't work in internet explorer is there something wrong with it <?php $file = $_GET["Watch"]; echo "<OBJECT ID='MediaPlayer' WIDTH='450' HEIGHT='310' CLASSID='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' STANDBY='Loading Windows Media Player components...' TYPE='application/x-oleobject'> <PARAM NAME=".$file." VALUE='../audio/audio_files/".$file.".wmv'> <PARAM NAME='autostart' VALUE='false'> <PARAM NAME='ShowControls' VALUE='true'> <PARAM NAME='ShowStatusBar' VALUE='true'> <PARAM NAME='ShowDisplay' VALUE='false'> <EMBED TYPE='application/x-mplayer2' SRC='../dvds/dvd_files/".$file.".wmv' NAME=".$file." WIDTH='450' HEIGHT='310' ShowControls='1' ShowStatusBar='1' ShowDisplay='0' autostart='0'></EMBED> </OBJECT>"; ?> hey back again, I need help finding something like the audio player found at www.soundowl.com. I need it to be similar in the sense that the URL of the file cannot be found in the source code and this is exactly what I need for my website, any help will be appreciated, thank you in advance Hi I'm building a site that contains access to some mp3 files of people speaking English. I would like a media player that is able to handle a variable that results from a database search. I can use <a href etc> to link to the relevant file but would like to use a server-side player to stream the file, rather than the client's browser. Something like Dewplayer would be perfect but it seems only to take a static file (maybe I'm wrong there). The player appears within <object> tags, like this <code> echo '<object type="application/x-shockwave-flash" data="/player/dewplayer.swf" width="200" height="30" id="dewplayer" name="dewplayer">'; echo '<param name="movie" value="/player/dewplayer.swf" />'; echo '<param name="flashvars" value="mp3=file.mp3" />'; echo '<param name="wmode" value="transparent" />'; echo '</object>'; </code> (the code is freely downloadable so hope I'm not breaking any rules posting someone else's code here). Is there a way I can specify a variable in value? If not, does anyone know of a player that I can use that does allow that? Grateful for any help. Thanks in advance. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314887.0 Hello Peeps Let's see if i can get out what i need to ask. Origin for Question: I have started to get into making Music. I create it(incomplete songs) on one pc and then normally have to upload it to the web and download it on another pc hooked upto a stereo and sound system. What i would prefer: I would like to make it on one pc and then upload it to a site and then the other pc can just goto the site like.. mysite.com/play.php?id=4 The Question: What would i need to look up for the best way to be able to upload and then play the song. i would not want to have it so i upload it and have to download it but rather i can go to a page as quoted above and there is simply a song playing there. i would like it to do something like the following * mySite.com has an upload section * when the file is uploaded it is saved as $id.mp3 (so first upload is 3 snd upload is 4.mp3 and so on.) on that note i'm also thinking of having it so i have to be logged in so then i can have $username-$id.mp3 *i would then like it to display the link.. ( Thankyou your upload is complete. your link is mysite/play.php?$username-$id.mp3) *then on that play page i would like a player that can load the song and play it by the vars.. so it looks for the $id and $username vars and then plays the file with that name. So i'm not asking for anyone to build this. i want to build it but i'm not sure what to look up for this. i feel i could so far do the login and research the upload and saving file names But its the music player side im confused on is there something out there in jquery or something maybe? i do not want to use flash.. i dont think :S I hope this makes sense and hope someone can help. Thanks I confess I am not a php coder but have managed to build a youtube player which plays from a list which is generated by a flat file data base. http://www.d-sine.com/DEV/CHW/movies/index.php I have also (nearly) built an admin backend where users can edit the database and add, delete and update their movie player list. http://www.d-sine.com/DEV/CHW/movies/admin/ pass = password the problem I have is that when the list is edited it throws in a return (a blank line) into the database resulting in an error when the player is refreshed after the change. When this blank line is taken out all is fine, I have got so close its frustrating arrrgghh Can anyone help??? The code in full is attatched Open Source, so if it is any use to anyone, be my guest ;-) Hi guys. My situation is the following... I want to be able to play videos on a website using a media player. I currently have the pathnames of the videos stored in a mysql database and the videos stored on my file system. I intend to use some PHP script in order to locate the video pathname in the database and then pass it to the media player where it will play the file. I was wondering how i go about this? as i am fairly new to PHP. The media player i am using can be found at: http://rainbow.arch.scriptmania.com/scripts/music/video.html Any help would be much appreciated I'm receiving the error "Object of class player could not be converted to string" yet I cannot find why what I'm inputting is an object and not a string. As far as I can see it is a string and this error shouldn't be happening, yet it is... A form submits to a page which gets the data thus: Code: [Select] <?php case "updplayer": if(!isset($_GET['id']) || !isset($_POST['kit']) || !isset($_POST['level']) || !isset($_POST['group']) || !isset($_POST['state'])) { header("location:admin.php?mode=settings&error=info&sid=$user->sid"); exit; } $var = "player" . $_GET['id']; $$var->kit = mysql_real_escape_string($_POST['kit']); $$var->level = mysql_real_escape_string($_POST['level']); $$var->group = mysql_real_escape_string($_POST['group']); $$var->state = mysql_real_escape_string($_POST['state']); $$var->update(); header("location:admin.php?sid=$user->sid"); exit; break; The update function is: Code: [Select] <?php function update() { echo "Name: $this->name <br /> Kit: $this->kit <br /> Level: $this->level <br /> Group: $this->group <br /> State: $this->state <br />"; $sql = "UPDATE `players` SET `name` = '" . $this->name . "', `preferredKit` = '" . $this-kit . "', `gamingLevel` = '" . $this->level . "', `group` = '" . $this->group . "', `draftState` = " . $this->state; if(!mysql_query($sql)) { return mysql_error(); } return TRUE; } I added the echo's in for error checking. They output exactly what was expected. What is wrong with this? Error occurs on the "$sql = " line. Hello. I just inherited a game stats system but it's not working properly. I'm gonna post the entire script: <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); $servername = "127.0.0.1"; $username = ""; $password = ""; $dbname = ""; $addresses = Array(); $nicknames = Array(); $servers = Array(); $times = Array(); $find_ip = $_GET["ip"]; $find_name = $_GET["nick"]; if(isset($_GET["format"])) { $format = $_GET["format"]; } else { $format = "include"; } $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { ReturnError("NO_CONNECTION"); } function ReturnError($error) { global $format; if($format == "mod") die("!DATA!ERROR:" .$error. "!DATA!"); else die("ERROR:" . $error); } function ReturnData($data) { global $format; if($format == "mod") die("!DATA!SUCCESS:" .$data. "!DATA!"); else die("SUCCESS:" .$data); } function GetServerIP() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) return $_SERVER['HTTP_CLIENT_IP']; else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) return $_SERVER['HTTP_X_FORWARDED_FOR']; else return $_SERVER['REMOTE_ADDR']; } function GetTimestamp() { $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); $now->format("m-d-Y H:i:s.u"); $local = $now->setTimeZone(new DateTimeZone('Europe/Prague')); return $local->getTimestamp(); } function GetFormatedTime() { $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); $now->format("m-d-Y H:i:s.u"); $local = $now->setTimeZone(new DateTimeZone('Europe/Prague')); return $local->format("Y-m-d H:i:s.u"); } function AddAddress($addr) { global $addresses; if(in_array($addr, $addresses, true)) { return false; } else { array_push($addresses, $addr); return true; } } function AddTime($time) { global $times; if(in_array($time, $times, true)) { return false; } else { array_push($times, $time); return true; } } function AddNickname($nick) { global $nicknames; if(in_array($nick, $nicknames, true)) { return false; } else { array_push($nicknames, $nick, true); return true; } } function AddServer($server) { global $servers; if(in_array($server, $servers, true)) { return false; } else { array_push($servers, $server, true); return true; } } function LookForIPs($ip) { global $conn; $sql = "SELECT * FROM `connections` WHERE `IP` = '".$ip."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { AddAddress($row["IP"]); AddServer($row["serverIP"]); AddTime(Array($row["datestamp"], $row["datestring"], $row["serverIP"])); if(AddNickname($row["nickname"]) && $row["nickname"] != "Player" && $row["nickname"] != "A_Edition_V2") { LookForNicknames($row["nickname"]); } } return true; } else { return false; } } function LookForNicknames($nick) { global $conn; $sql = "SELECT * FROM `connections` WHERE `nickname` LIKE '".$nick."'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { AddNickname($row["nickname"]); AddServer($row["serverIP"]); AddTime(Array($row["datestamp"], $row["datestring"], $row["serverIP"])); if(AddAddress($row["IP"])) { LookForIPs($row["IP"]); } } return true; } else { return false; } } function SortTimes() { global $times; $good = false; while($good == false) { $good = true; for($i = 0; $i < count($times); $i++) { if($i+1 == count($times)) continue; if($times[$i][0] < $times[$i + 1][0]) { $tmp = $times[$i]; $times[$i] = $times[$i + 1]; $times[$i+1] = $tmp; $good = false; } } } } function GenerateLastSeenString($fromTime) { $time_now = GetTimestamp(); if($time_now < $fromTime) { return "N/A"; } if($fromTime == 0 || $fromTime =="") { return "N/A"; } $ss = $time_now - $fromTime; $seconds = $ss%60; $minutes = floor(($ss%3600)/60); $hours = floor(($ss%86400)/3600); $days = floor(($ss%2592000)/86400); $months = floor($ss/2592000); $str = ""; if($months != 0) { if($str != "") $str = $str . " "; if($days == 1) $str = $str . $months . " month"; else $str = $str . $months . " months"; } if($days != 0) { if($str != "") $str = $str . " "; if($days == 1) $str = $str . $days . " day"; else $str = $str . $days . " days"; } if($hours != 0) { if($str != "") $str = $str . " "; if($hours == 1) $str = $str . $hours . " hour"; else $str = $str . $hours . " hours"; } if($minutes != 0) { if($str != "") $str = $str . " "; if($minutes == 1) $str = $str . $minutes . " minute"; else $str = $str . $minutes . " minutes"; } if($seconds != 0) { if($str != "") $str = $str . " "; if($seconds == 1) $str = $str . $seconds . " second"; else $str = $str . $seconds . " seconds"; } return $str. " ago"; } function ClearResult($arr) { for($i = 0; $i < count($arr); $i++) { if(gettype($arr[$i]) == "boolean") { //echo "Found bool at $i"; array_splice($arr, $i, 1); } } return $arr; } function PrintArray($arr) { for($i = 0; $i < count($arr); $i++) { echo $arr[$i]; if($i + 1 != count($arr)) { echo ", "; } } } if($format == "mod") { LookForNicknames($find_name); LookForIPs($find_ip); $nicknames = ClearResult($nicknames); $addresses = ClearResult($addresses); $servers = ClearResult($servers); $conn->close(); /*if (!filter_var($find_ip, FILTER_VALIDATE_EMAIL) && $find_ip != "") { $find_ip = $addresses[0]; }*/ if($find_ip == "") { $find_ip = $addresses[0]; } if($find_ip == "") { $find_ip = "0.0.0.0"; } if(count($nicknames) == 0 && count($addresses) == 0) { ReturnError("NOT_FOUND"); } echo "!DATA!"; echo "Nicknames used: "; PrintArray($nicknames); echo "*-*"; echo "Total IPs used: "; echo count($addresses); echo "*-*"; echo "Location: "; echo file_get_contents("http://127.0.0.1/db/getlocation.php?ip=$find_ip"); echo "*-*"; echo "Connected: "; echo count($times); echo " times*-*"; SortTimes(); if(GetTimestamp() - $times[0][0] < 60 * 60) echo "Last seen: " . GenerateLastSeenString($times[1][0]) . "*-*"; else echo "Last seen: " . GenerateLastSeenString($times[0][0]) . "*-*"; echo "First seen: " . GenerateLastSeenString($times[count($times)-1][0]); echo "!DATA!"; } else if($format == "debug") { LookForNicknames($find_name); LookForIPs($find_ip); $nicknames = ClearResult($nicknames); $addresses = ClearResult($addresses); $servers = ClearResult($servers); $conn->close(); /*if (!filter_var($find_ip, FILTER_VALIDATE_EMAIL) && $find_ip != "") { $find_ip = $addresses[0]; }*/ if($find_ip == "") { $find_ip = $addresses[0]; } if($find_ip == "") { $find_ip = "0.0.0.0"; } if(count($nicknames) == 0 && count($addresses) == 0) { ReturnError("NOT_FOUND"); } echo "Nicknames used: "; PrintArray($nicknames); echo "<br>"; echo "IPs used: "; PrintArray($addresses); echo "<br>"; echo "Location: "; echo file_get_contents("http://127.0.0.1/db/getlocation.php?ip=$find_ip"); echo "<br>"; echo "Connected: "; echo count($times); echo " times<br>"; SortTimes(); echo "Last seen: " . GenerateLastSeenString($times[0][0]) . "<br>"; echo "First seen: " . GenerateLastSeenString($times[count($times)-1][0]) . "<br>"; echo $find_name; } ?> The problem is that for some nicknames it returns a proper output which should look like this:
But sometimes it just returns lots and lots of data even if the nickname I ask for is unique enough:
Here's how the database looks:
I don't know what's wrong with the script because I'm a PHP beginner. If someone could take a look at it and tell me what's the issue I'd appreciate. Edited September 22, 2020 by jevgienijHoping someone could help me with hiding a video player if a video is not present in the db. I have split up the code to make it easier to understand. Thanks in advance (int) $ListId=$_GET['ListID']; function mysql_resultTo2DAssocArray ( $result) { $i=0; $ret = array(); while ($row = mysql_fetch_assoc($result)) { foreach ($row as $key => $value) { $ret[$i][$key] = $value; } $i++; } return ($ret); -------------------------------------------------------------------------------------------- $querys = mysql_query("SELECT * FROM video WHERE listingID = '$ListId' "); $Details_video=mysql_resultTo2DAssocArray ($querys); -------------------------------------------------------------------------------------------- <div class="right_col"> <p id='preview'>The player will show in this paragraph</p> <script type='text/javascript' src='/flvPlayer/swfobject.js'></script> <script type='text/javascript'> var s1 = new SWFObject('/flvPlayer/player-viral.swf','player','280','200','9'); s1.addParam('allowfullscreen','true'); s1.addParam('allowscriptaccess','always'); s1.addParam('autostart','true'); s1.addParam('image','/flvfiles/<?php echo $Details_video[0]['imagePath']?>'); s1.addParam('flashvars','&file=/flvfiles/<?php echo $Details_video[0]['videoPath']?>&image=/flvfiles/<?php echo $Deatls_video[0]['imagePath']?>&dock=false&autostart=true'); s1.write('preview'); </script> hi i am getting syntax error in the following php code. Can any one help me in this regard. Code: [Select] <?php echo "<script type=\"text/javascript\" src=\"http://funxy.com/sabaadmin/swfobject.js\"></script> <script type=\"text/javascript\"> var s1 = new SWFObject("http://www.funxy.com/sabaadmin/flvplayer.swf","single","320","280","7"); s1.addParam("allowfullscreen","true"); s1.addVariable("file","$player"); s1.addVariable("image","$image"); s1.addVariable("width","320"); s1.addVariable("height","280"); s1.write("player1"); </script>"; ?> I'd like to use an application that's not browser based, on Internet Explorer. I've read somewhere that this is possible with a PHP script, but which one? If you can get me on the right track, I'd really appreciate it. Cheers. I am able to make the map shift to the direction as intended but I got a few other problems: 1. The player location isn't properly loaded, eventhough it saved to the database successfully (I use locationX and locationY as XY coordinate individually). The X and Y corrdinates shows up on the URL itself like this ".../main.php?x=#&y=#". But if I remove them and then hit enter again the it will reset the position back to the original location of the map. 2. The player tile does not appears in center of the map tiles. Here is the page I uploaded my PHP script: http://student18.gamfe.com.hk/facebook/main.php Here is the map portion of the code: Code: [Select] <?php $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error with MySQL connection'); mysql_query("SET NAMES 'utf-8'"); mysql_select_db($dbname) or die(mysql_error()); $query = "SELECT * FROM game_user WHERE game_id = '00001'"; $result = mysql_query($query) or die(mysql_error()); if ((!empty($_GET["x"])) && (!empty($_GET["y"]))) { $updateString = "UPDATE game_user SET locationX=".$_GET["x"].", locationY=" .$_GET["y"]. " WHERE game_id = '00001'"; mysql_query($updateString); } else { $x = 2; $y = 2; } ?> ... // Phrasing map tiles and player tile code <?php $file = file_get_contents('./images/maps/33/map.txt', true); $entries = explode("\n", $file); for($i=$x-2;$i<=$x+2;$i++){ $data = explode(",", $entries[$i]); for($j=$y-2;$j<=$y+2;$j++){ echo "<td align=\"center\" background=\"images/maps/33/33_"; echo $data[$j]; echo ".gif\" width=\"65\" height=\"65\"> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"65\" height=\"65\"> <tbody><tr> <td> <center>"; while($rows = mysql_fetch_array($result)) { if(($rows['locationX'] == $_GET["x"]) && ($rows['locationY'] == $_GET["y"])) { echo "<img src=\"../images/player_tile.gif\" title=\"You are here\">"; } } echo "</center> </td> </tr></tbody> </table> </td>"; } echo "</tr><tr>"; } ?> I want to place Custom background image for embedded media player Can anyone help me? |