Results 1 to 6 of 6

Thread: Is it better to use php code to embed media file?

  1. #1
    Join Date
    Nov 2006
    Posts
    55
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default 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.

  2. #2
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    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 Code:
    <?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>
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  3. #3
    Join Date
    Nov 2006
    Posts
    55
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    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>

  4. #4
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    they're both in The Same PHP document.

    PHP Code:
     <?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>
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  5. #5
    Join Date
    Nov 2006
    Posts
    55
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    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.

  6. #6
    Join Date
    Mar 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Php Code for video to play on webpage from hard disk

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •