View Full Version : Is it better to use php code to embed media file?
Could someone advise on the advantages and disadvantages (such as shorter downloading time) on the 2 ways of embedding appended below:
<EMBED SRC="video.php?file=name" WIDTH=320 HEIGHT=256 AUTOPLAY=true CONTROLLER=true LOOP=false PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/">
<EMBED SRC="filename.wmv" WIDTH=320 HEIGHT=256 AUTOPLAY=true CONTROLLER=true LOOP=false PLUGINSPAGE="http://www.microsoft.com/Windows/MediaPlayer/">
Many thanks in advance.
boxxertrumps
01-12-2007, 12:41 AM
you can keep a list of the file names and their keys then serve whichever file is specified with ?file=
PHP is The Best Way To go.
for example, this is what i use...
<?php
$stream[] = array(" "," ");
$stream[] = array("Boxxertrumps Radio","BoxxersStream.m3u");
$stream[] = array("VGAmp","VGampStream.m3u");
$stream[] = array("ReaLife Radio","RLRStream.m3u");
$stream[] = array("102.1 The Edge","1021Kdge.m3u");
$stream[] = array("Cronix Metal","Cronixmetal.m3u");
$stream[] = array("100% Rock","100%rock.m3u");
$stream[] = array("Megarock","Megarock.m3u");
$stream[] = array("Spacial","Spacial.m3u");
$stream[] = array("Real Hardcore","Realhardcore.m3u");
$stream[] = array("Rock 104","rock104.m3u");
$stream[] = array("Rush Radio","rush.m3u");
$stream[] = array("Snakenet Radio","snakenet.m3u");
$stream[] = array("Social Crime","Socialcrime.m3u");
$stream[] = array("Khaha Radio","khaha.m3u");
$pag = $_GET[chan]; ?>
<h2><?php echo $stream[$pag][0]; ?></h2>
<embed src="Streams/<?php echo $stream[$pag][1]; ?>" autostart="false" type="application/x-mplayer2" width="300" height="45" volume="100" showcontrols="1" showstatusbar="0" enablecontextmenu="0" displaysize="0" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">
</embed>
Thanks a lot, boxxertrumps.
I am a PHP newbie and I would appreciate if you could elaborate a little further on the codes that you used.
Using notebook to create a php file below?
<?php
$stream[] = array(" "," ");
$stream[] = array("Boxxertrumps Radio","BoxxersStream.m3u");
$stream[] = array("VGAmp","VGampStream.m3u");
$stream[] = array("ReaLife Radio","RLRStream.m3u");
$stream[] = array("102.1 The Edge","1021Kdge.m3u");
$stream[] = array("Cronix Metal","Cronixmetal.m3u");
$stream[] = array("100% Rock","100%rock.m3u");
$stream[] = array("Megarock","Megarock.m3u");
$stream[] = array("Spacial","Spacial.m3u");
$stream[] = array("Real Hardcore","Realhardcore.m3u");
$stream[] = array("Rock 104","rock104.m3u");
$stream[] = array("Rush Radio","rush.m3u");
$stream[] = array("Snakenet Radio","snakenet.m3u");
$stream[] = array("Social Crime","Socialcrime.m3u");
$stream[] = array("Khaha Radio","khaha.m3u");
$pag = $_GET[chan]; ?>
The one below is for the HTM file? Name of the php file?
<h2><?php echo $stream[$pag][0]; ?></h2>
<embed src="Streams/<?php echo $stream[$pag][1]; ?>" autostart="false" type="application/x-mplayer2" width="300" height="45" volume="100" showcontrols="1" showstatusbar="0" enablecontextmenu="0" displaysize="0" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/">
</embed>
boxxertrumps
01-13-2007, 12:31 AM
they're both in The Same PHP document.
<?php $stream[] = array("Title of File(shown with $stream[$pag][0];) ","file name (shown with $stream[$pag][1];)");
this gets the number from the url when the URL is .php?chan=0-"the number of stream entries you have."
$pag = $_GET[chan]; ?>
Then $pag is used to call whichever stream you want from the array
Echos out the title:
<h2><?php echo $stream[$pag][0]; ?></h2>
echos the video/stream filename
<embed src="Streams/<?php echo $stream[$pag][1]; ?>" /*-----*/ ></embed>
I have used php code to play wmv file.
I noticed that the buffering time takes longer.
Is it possible to improve on that.
Also, when the same wmv is played the second and subsequent times, it is still doing the buffering instead of playing smoothly (since the wmv would have been cached the first time the video is played).
I would be grateful if someone could enlighten me.
Many thanks in advance.
GoldenAxe
03-03-2007, 08:02 PM
Hi jass,
Could you or anyone lend some advice as to how to play a video file using raw data from the harddisk without going through hosting on another website?
Please advise, thanks.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.