PHP - Media Player In Php
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>"; ?> Similar TutorialsHi 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. 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 want to place Custom background image for embedded media player Can anyone help me? well.. 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.. I want to create a media library in the CMS, similar to how it is in WordPress but custom-coded in PHP on my own site. Can this be done simply with a database connection or will the images need to be uploaded to a server? Bit confused as to how it works and which is the best way to go about it. Thanks for any help. Edited January 12 by Richie1209I have Wordpress based site where i've included a class for the main menu that produces a hover and shadow effect. Problem is it breaks the menu in the fully responsive mode when the display adjusts for the viewing dimensions. So I need to remove that class from the menu for anything related to the @media controls.
The site is viewable he http://ailimconsulting.com
If you view it full screen then you'll see the hover effect. Shrink it down and you'll see the menu collapses (it's designed to) but when you use the menu the shadow/hover effect is still present and 'breaks' the menu (loooks like jumbled crap). We just want to remove the hover effect for viewing on mobile devices.
I'm not sure if there's a CSS way to 'remove' a class. This may have to be done with jQuery. I'm looking for options and if anyone knows how I would either remove or counteract the float-shadow class.
Thanks.
Hi, I need to unlink my images in my Media Library (wordpress) on my blog: http://www.jbiddulph.com/blog/index.php/featured/ Please help?! I think it is in this piece of code: foreach ( $attachments as $id => $attachment ) { $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); $output .= "$link"; if ( $captiontag && trim($attachment->post_excerpt) ) { $output .= " " . wptexturize($attachment->post_excerpt) . " "; } if ( $columns > 0 && ++$i % $columns == 0 ) $output .= ''; } Hi all
I am using media queries in my css to create a responsive site, when I view the site on a mobile, the site responds as I intend it to.
However if I view it on a desktop and resize the screen, it doesn't respond as I would like, the idea is, if I resize the desktop version enough then I will view the mobile version.
in one css file I have
@media screen and(max-width: 1024px) { css styles }and then on another file, I have the following, the idea with this is when I get below the specified screen size the items don't show @media screen and (min-width: 1024px) { }if you need any more info let me know. Thanks Mark I'm learning to develop social media buttons, and I'm trying to figure out, how to find out the correct submit links to the social media sites? For example: Digg has their submit link like this: return "<a href='http://digg.com/submit?url=$link& title=$title&bodytext=$text'>Digg This</a>"; Digg also requires to use urlencode for the variables inside the URL. But delicious has their submit link like this: return "<a href='http://del.icio.us/post?url= $link&description=$text&replace=no'>Add to Delicious</a>"; When I go on delicious.com (under this URL: http://www.delicious.com/help/api#posts_add) I will find the link: Code: [Select] https://api.del.icio.us/v1/posts/add? Which is stated on the API page, but that link won't work. I rather have to use the link I showed earlier. So my question is, what is the proper way in figuring the correct submit links for each website and how to format them properly to their requirements, I can not find any information on the websites? So I can build social media buttons to the other sites as well. We are building a site for users to post articles on certain topics and we want to show their number of followers on various social media platforms. Apart from them having the means to add it manually, there must be a method of syncing with their account, that they punch in, so that it dynamically updates our database with their number of followers. How is it done? Hi phpfreaks, please I have being working on a media site for few months now and I have designed everything that needs to be designed but A♏ having problems with my uploading code its not storing the file size in the database, I have tried and tried and all what have being doing seem to be taking me away from the right way with my little understanding of php. Here is the code that is giving me headache , <?php //include("includes/sess.php"); ?> <?php $upload="active"; include("includes/mheader.php"); ?> <?php if(isset($_POST['Upload'])) { ////////////////////////////////// //$id=$_POST['id']; $picture=$_POST['picture']; $artiste=$_POST['artiste']; $title=$_POST['title']; $genre=$_POST['genre']; $uname=$_POST['uname']; if($title=="") { $message="unknown Title"; header("location:upload.php?message=$message"); exit(); } if($genre=="") { $message="unknown Type"; header("location:upload.php?message=$message"); exit(); } /*if($nfile=="") { $message="file not found"; header("location:upload.php?message=$message"); exit(); } */ if($uname=="") { $message="error you"; header("location:upload.php?message=$message"); exit(); } if($artiste=="") { $message="Artiste ?"; header("location:upload.php?message=$message"); exit(); } header("location:upload.php?message=$message"); ////////////////////////////////// $size=$_FILES["picture"]["size"]; $file_size1 = $size/1024 ; $file_size = $file_size1/1000 ; function UploadOne($fname) { $uploaddir = 'music/NaijaMp3_'; if (is_uploaded_file($fname['tmp_name'])) { $filname = basename($fname['name']); $uploadfile = $uploaddir . basename($fname['name']); if (move_uploaded_file ($fname['tmp_name'], $uploadfile)) $res = "File " . $filname . " was successfully uploaded and stored.<br>"; else $res = "Could not move ".$fname['tmp_name']." to ".$uploadfile."<br>"; } else $res = "File ".$fname['name']." failed to upload."; return ($res); } ?> <?php if ($_FILES['picture']['name'] != "") { $res = UploadOne($_FILES['picture']); $filname = $_FILES['picture']['name']; $filname=addslashes($filname); ///////////////////////////////////////////////////////////// $alt_file_name = "NaijaMp3_" .$filname ; $date_created=date("Y-m-d h:i:A"); include("includes/db_connect.php"); $sql="INSERT INTO upmp3(uname,file_name,alt_file_name,file_size,artiste,title,genre,date_created) VALUES('$uname','$filname','$alt_file_name','$file_size','$artiste','$title','$genre','$date_created')"; mysql_query($sql) or die (mysql_error()); $message="Upload Sucessful"; ///////////////////////////////////////////////////////////// echo ($res); } } ?> <div class="main_but"> </div> </div> <!-- Navigation begins here --> <!-- Header section ends here --></div> <div class="login"> </div> <div id="feature"> <blockquote/> <div align="center"><em><strong>UPLOAD FILE </strong></em></div> <form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p> <br /> </p> <p>{Note: All * fields are Mandatory} </p> <p> <label> <input name="picture" type="file" id="picture" /> </label> </p> <p>File Type <label> <select name="type" id="type"> <option value="mp3">mp3</option> </select> </label> </p> <p>Artiste*<span class="style1"><sub>(e.g Alashine)</sub></span> <label> <input name="artiste" type="text" id="artiste" /> </label> Title <label> <input name="title" type="text" id="title" /><span class="style1"> </label> <p>Genre <label><input name="genre" type="text" id="genre" />(Genre e.g Hiphop, RnB, Reggae . . .)</span></label> <input type='hidden' name='id' value='<?php echo"$id" ?>' id='id'/> <input type='hidden' name='uname' value='<?php echo"$uname" ?>' id='uname'/> <label></label> </p> </p> <p> <label> <input name="Upload" type="submit" id="Upload" value="Upload Mp3" /> </label> </p> </form> </div> </div> <?php include("includes/footer.php"); ?> </div> Thanks for your help in anticipation 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 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 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314887.0 Hello everybody,
I am honestly quite a newb when it comes to mod_rewrite.
We run a small social media page with different areas and I would like to change the URLs to something more clean and professional.
User profiles look like this:
http://www.sky-mp3.com/index.php?action=cm&siteid=59&wahl=artists&tat=details&keyid=477siteid 59 is the artists list and the keyid at the end is the ID of the artist but should be like: http://www.sky-mp3.com/mischuraor in worse case like: http://www.sky-mp3.com/user/mischuraCMS pages look like this: http://www.sky-mp3.com/index.php?siteid=106but should be like: http://www.sky-mp3.com/charts(page name instead of siteid) What I know so far: - I have to add something to the .htaccess file - I need to change something in the code (but I don`t know where) Im good he? What would be the first step on the path to clean URLs for me? I found alot of infos here and there but found nothing yet for this specific case. Kind regards from and thx in advance from Cologne 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); 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 ;-) Hoping 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> 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 jevgienij |