PHP - Play A Avi Or Mpg Video With Php?
Hiya!
Is it possible to play an avi or mpg video file with php? If not is there any other recommeded scripts out there be it jquery, ajax, js ect that will do this? Many thanks, James. Similar TutorialsHi guys, My first post here. I would like to seek you guys help about playing video from mysql. I wanted to upload video to database and also play it inside my webpage using the media player format. Thank in advance Hi, How to play any website's video using php.I searched many website.All are mention code for play video using a particular website like youtube only or VEOH only or Vimo only and etc. I need play video using any website's URL when we give input as valid url.Send me reply quick please......... Hi, tried google'ing for an answer but found very little help, so decided to post here. I need a way to play a 2 second wav or mp3 file in a shell script. Is there any way to do this? I was hoping for something as simple as this if possible if ($GetHit == 'true') { $PlaySound; echo "Sound Played\n\n"; } Thanks How can i play with these role in my database table as you can see here //I have a database table CREATE TABLE users ( id int(10) NOT NULL PRIMARY KEY AUTO_INCREMENT, urole varchar(10) ); in the role column, I have 2 roles first role is only used once but the sound one can be assigned to more than one user, now I want to check my table if the first role is already registered, then we can't register user with that role, also the second role can exist two or more times //check role, a variable user role has been defined as $urole = $_POST['urole']; $check = $connect -> prepare('SELECT * FROM users WHERE urole = ?'); $check -> execute([$urole]); $checkfetch = $check -> fetch(); //I'm stacking here, I want to put $checkfetch['urole'] in rowCount() to be counted but I think this is not a correct way of using rowCount() if(($checkfetch['urole'] == 'MainAdmin') && ($checkfetch ->rowCount() == 1)) { echo 'This role can be used by only once!'; } //another role if(($checkfetch['urole'] == 'NormalAdmin') && ($checkfetch ->rowCount() < 4)) { echo 'This role can be used 4 times only!'; }
Here's my script: <?php $ch=curl_init('http://www.pictureinthesky.net/bltest/method1.php'); curl_setopt($ch,CURLOPT_COOKIEJAR,'cookie.txt'); curl_setopt($ch,CURLOPT_COOKIEFILE,'cookie.txt'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt($ch,CURLOPT_HEADER,false); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true); curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,'crime=1&vercode=ABC'); $page=curl_exec($ch); if (curl_errno($ch)) { echo 'ERROR'; } curl_close($ch); echo $page; ?> I'm trying to get that to call the URL in the script to check the anti XSS code in my other script is working but all it does is read the page in without submitting the form -I should get an error message! I've checked and the cookie.txt file is being created and contains: Code: [Select] # Netscape HTTP Cookie File # http://curl.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. www.pictureinthesky.net FALSE / FALSE 0 PHPSESSID 7268ef0b4b6adae605156ac177bdd43e EDIT: The above script can be tried: http://www.pictureinthesky.net/curl/readpage.php I think it might be failing because cURL hasn't been told the name of the submit button and in my code I'm checking for it by name. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=327233.0 This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=320387.0 I thought to relax a bit and while i saw something and an idea came to my mind, lets play noobs, it will be fun... we ask noob questions here lolzzz
so my question is
Hello,
I have seen that there are always 3 users /* I know these are bots */ Google, Yahoo and Bing always online and we cannot see their profiles. They must be very professional hackers who have known how to hide their identities.. right??
This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=307175.0 Ok say i have a database with users who have a video url field for them to enter a video url to be submitted to the database, im trying to create a page where the videos will be displayed one at a time for example ' 1st video plays then it switches to the next random video from the database and so on' i want only to play so many seconds of the video before it switches as they will be presentations so i dont want viewers to watch them all in full, could anyone help me out with some code or feedback on this please? Hello, i just joined the forums, nice forum . Well im looking for a solution. I want download the videos from a site, but i cant find a solution how to get the location of the video, cause its dynamic. Here is a sample video: http://www.collegehumor.com/video:1946215 And here is the link to the video: http://8.media.collegehumor.cvcdn.com/21/12/a8cc907f5e150fe77ce7c0c47b1b9d31.mp4 That link i got via a FIREFOX Addon called "DownloadHelper" this addon finds the location with help of http headers. So is it possible way to find the videos with php? Thanks for help. hello, i have read topic on the internet that says i have to buy an adobe media interactive server and moyea so that you can have a video on the internet (without using you tube). how can i install a software like this to the webhost? thanks everyone. hi all How we can read the id of an element tag on the html page to use it in a sql query for selecting a particular record. or else how we can simply connect a link to jwplayer to play in the specific area defined for it. That we just click that link and it will play a video in that area. how it is implement in php In my php web site the video player appears and plays the video. In Chrome you can right click on the player screen and choose 'inspect element' etc, but another choice is 'Copy video URL'. How can I block that, or hide (or disguise/rename) video URLs?
Hi, I want to restrict my registered user to see video only once per day... Can anyone guide me how can i do this with php??? Thanks Hi I am having an issue searching videos from youtube when ever I do a search i keep getting an page not found error. here is my code Code: [Select] <? class Youtube { var $dom, $idvideo, $title, $video; //function for video title function videoTitle() { return $this->title; } function pagination() { return true; } function tag($tag, $page = 1) { if ($page <= 0) $page = 1; $start = ($page-1)*10 + 1; $tag = str_replace(' ', '+', $tag); $feed = ('http://gdata.youtube.com/feeds/api/videos?vq='.$tag.'&start-index='.$start.'&max-results=10&orderby=updated&alt=rss'); $this->dom = getFeed($feed); } function video($id) { $this->idvideo = $id; $feed = ("http://gdata.youtube.com/feeds/api/videos/".$id); $this->dom = getFeed($feed); $this->video = $this->dom->getElementsByTagName('entry')->item(0); $this->title = $this->video->getElementsByTagName('title')->item(0)->textContent; } function player() { ?> <object width="425" height="355"> <param name="movie" value="http://www.youtube.com/v/<?=$this->idvideo?>" /> <param name="wmode" value="transparent" /> <embed src="http://www.youtube.com/v/<?=$this->idvideo?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed> </object> <? } function view($tag) { $videos = $this->dom->getElementsByTagName('item'); foreach ($videos as $video) { $id = $video->getElementsByTagName('guid')->item(0)->textContent; $id = explode('/', $id); $id = $id[6]; echo '<div class="video">'; $title = $video->getElementsByTagName("title")->item(0)->textContent; echo '<p><a href="'.BASE_URL.'/0/video/'.$tag.'/'.$id.'.html">'.$title.'</a></p>'; $fotos = $video->getElementsByTagNameNS("http://search.yahoo.com/mrss/", "thumbnail"); $tiempo = $video->getElementsByTagNameNS("http://gdata.youtube.com/schemas/2007", "duration"); $tiempo = $tiempo->item(0)->getAttribute("seconds"); $i = 0; echo '<div class="img">'; foreach ($fotos as $foto) { $url = $foto->getAttribute("url"); echo '<a href="'.BASE_URL.'/0/video/'.$tag.'/'.$id.'.html"><img src="'.$url.'" alt="'.$title.'"/></a>'; $i++; if ($i > 2) break; } echo '</div>'; echo '<p class="links"><a href="'.BASE_URL.'/0/video/'.$tag.'/'.$id.'.html">'._VIEW.'</a> '._DURATION.': '.minutes($tiempo).'</p>'; echo '<p>'.cut($video->getElementsByTagName("description")->item(0)->textContent).'</p>'; $tags = $video->getElementsByTagName("category"); echo '<div class="tags">'; echo 'tags: '; foreach ($tags as $palabra) { if (strpos($palabra->textContent, "http") === FALSE) echo '<a href="'.BASE_URL.'/0/tag/'.$palabra->textContent.'.html">'.$palabra->textContent.'</a> '; } echo '</div>'; echo '</div>'; } } function videoInfo() { $id = $this->video->getElementsByTagName("id")->item(0)->textContent; $id = explode("/", $id); $id = $id[6]; echo '<div class="video">'; $title = $this->video->getElementsByTagName("title")->item(0)->textContent; $tiempo = $this->video->getElementsByTagNameNS("http://gdata.youtube.com/schemas/2007", "duration"); $tiempo = $tiempo->item(0)->getAttribute("seconds"); echo '<p class="links">'._DURATION.': '.minutes($tiempo).'</p>'; echo '<p>'.$this->video->getElementsByTagName("description")->item(0)->textContent.'</p>'; $tags = $this->video->getElementsByTagNameNS("http://www.w3.org/2005/Atom", "category"); echo '<div class="tags">'; echo 'tags: '; foreach ($tags as $palabra) { if (strpos($palabra->getAttribute("term"), "http") === FALSE) echo '<a href="'.BASE_URL.'/0/tag/'.$palabra->getAttribute("term").'.html">'.$palabra->getAttribute("term").'</a> '; } echo '</div>'; echo '</div>'; } } ?> Ok, this is killing me, So I'm finally asking for help. I'm working on a website, which streams videofiles from external links. The site plays & allows you to download the videos from the same external link. I need to mask the url of these videos. At the moment, I have successfully masked the url when downloading. If you click the download image, rather than the path being http://externalsite.com/videofile.avi its http://mysitename.com/external.php?id=xx&mid=xx So that is nicely hidden. However, I am having a problem when it comes to the embedded player on the page. At the moment i am using flowplayer for flv & mp4 videos, and just the usual embed for avi videos. Flow players embed code is like this --------------------------------------------------- <a href="<?=$videoFile?>" style="display:block;width:740px;height:400px;" id="player"> </a> <script language="JavaScript"> flowplayer("player", "<?=url::base()?>flowplayer-3.2.5.swf", { clip: { autoPlay: false, autoBuffering: true } }); </script> ----------------------------------------- At the moment, the player only works if i put the url in this format: http://externalsite.com/videofile.avi and wont work in this format http://mysitename.com/external.php?id=xx&mid=xx all download.php does is check the file exists, sets the headers and prompts users to open or save. Why isnt this working with the player? Please see the attached external.php file for my heade info etc to hopefully shed some light on this So i have a large video files, 1.5 gigs even. I made an html5 video player where the source is a php file. The php file is supposed to go below the web root and serve the video file to the html5 video tag. This all works just fine if the video using a script that uses HTTP_RANGE to serve the file in parts to the client. The problem is, once one video is playing - i can't do anything else. Its like the server locks up. I mean i can scrub that video, i can do anything to that page. I just can't navigate away. But i can open a new browser and play a new video. But again, once that first one is playing, or even paused, i can't do anything else. That is of course until i restart apache. Any ideas on how to stream these large files better? I have a feeling they are set to stream and never stop. This is the code for that Code: [Select] function rangeDownload($file) { $fp = @fopen($file, 'rb'); $size = filesize($file); // File size $length = $size; // Content length $start = 0; // Start byte $end = $size - 1; // End byte // Now that we've gotten so far without errors we send the accept range header /* At the moment we only support single ranges. * Multiple ranges requires some more work to ensure it works correctly * and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 * * Multirange support annouces itself with: * header('Accept-Ranges: bytes'); * * Multirange content must be sent with multipart/byteranges mediatype, * (mediatype = mimetype) * as well as a boundry header to indicate the various chunks of data. */ header("Accept-Ranges: 0-$length"); // header('Accept-Ranges: bytes'); // multipart/byteranges // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2 if (isset($_SERVER['HTTP_RANGE'])) { $c_start = $start; $c_end = $end; // Extract the range string list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); // Make sure the client hasn't sent us a multibyte range if (strpos($range, ',') !== false) { // (?) Shoud this be issued here, or should the first // range be used? Or should the header be ignored and // we output the whole content? header('HTTP/1.1 416 Requested Range Not Satisfiable'); header("Content-Range: bytes $start-$end/$size"); // (?) Echo some info to the client? exit; } // If the range starts with an '-' we start from the beginning // If not, we forward the file pointer // And make sure to get the end byte if spesified if ($range == '-') { // The n-number of the last bytes is requested $c_start = $size - substr($range, 1); } else { $range = explode('-', $range); $c_start = $range[0]; $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; } /* Check the range and make sure it's treated according to the specs. * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html */ // End bytes can not be larger than $end. $c_end = ($c_end > $end) ? $end : $c_end; // Validate the requested range and return an error if it's not correct. if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { header('HTTP/1.1 416 Requested Range Not Satisfiable'); header("Content-Range: bytes $start-$end/$size"); // (?) Echo some info to the client? exit; } $start = $c_start; $end = $c_end; $length = $end - $start + 1; // Calculate new content length fseek($fp, $start); header('HTTP/1.1 206 Partial Content'); } // Notify the client the byte range we'll be outputting header("Content-Range: bytes $start-$end/$size"); header("Content-Length: $length"); // Start buffered download $buffer = 1024 * 8; while(!feof($fp) && ($p = ftell($fp)) <= $end) { if ($p + $buffer > $end) { // In case we're only outputtin a chunk, make sure we don't // read past the length $buffer = $end - $p + 1; } set_time_limit(0); // Reset time limit for big files echo fread($fp, $buffer); flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit. } fclose($fp); } Hi,i m confused php developer (beginner bt i wnt to do advance things with php and mysql) i want to make video website for myself and i also have 10000s of video in my pc and can any one help me to complete this project 1. when user clik on some video thumbnail the video player(jw or flow player) pop-up and start the video without go to different page(if possible) 2.do i need to upload all my video first to my server or i upload it with php mysql then how is it possible to link and make thumbnail of all the 10000s videos with video player so all the video will play without error and i knw i cant make these 10000s videos thumbnails and video link and pages for each videos so how can i start my thing please help me in this a BIG THANKS in advance When I play a video (that is blocked from being downloaded as a file from a php web script player that I'm using) I can see the url address of the file from my PC in dev tools > networking > media, Is there a way to block or scramble the video's url from being available to be copied? If not, is there a way to have that url be available only if the potential viewer is 'logged-in' to the web site? Or some type of authentication based on checking for a user's PHP temp session file before allowing access from the video's url? |