Welcome Guest, Not a member yet? Register   Sign In
http psuedo streaming flv videos trouble with Code Igniter
#1

[eluser]chuckleberry13[/eluser]
Hi, I am new to code igniter and have been loving it so far except I am having a hard time getting flash videos to pseudo stream with code igniter. Any help would be appreciated.

I have a controller loading a view file (video/player.php) where player.php uses a javascript script to embed the flash player and also calls a php script to do the leg work of the "psuedo streaming." I think the problem is with the php script that does the leg work of the streaming isn't running for some reason. When I try it outside the code igniter folder it runs great so I am assuming that code igniter is blocking something from running. The script that does the streaming leg work uses the get string variable so I think that is what is keeping it from running right. Is there anyway around that if that is the problem? The php script is being called outside of code igniter's folders so I thought that I might get around the get string being blocked but it looks like I was wrong. Any help would be much appreciated.

To see documentation or a demo of the php streaming follow this link http://www.inwayvideo.com/phpflvplayer/index_en.html

Thanks in advance for the help!

Here is the flvprover.php script that is suppose to do the leg work of the streaming

Code:
<?php
    
    // ----- NO CACHE -----
    session_cache_limiter('nocache');

    // General header for no caching
    $now = gmdate('D, d M Y H:i:s') . ' GMT';
    header('Expires: ' . $now); // rfc2616 - Section 14.21
    header('Last-Modified: ' . $now);
    header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
    header('Pragma: no-cache'); // HTTP/1.0

    // ----- Seek position -----
    $seekat = 0;
    if (isset($_GET["pos"])) {
        $position = $_GET["pos"];
        if (is_numeric ($position)) {
            $seekat = intval($position);
        }
        if ($seekat < 0) $seekat = 0;
    }

    // ----- file -----
    $filename = "";
    if (isset($_GET["file"])) {
        $filename = htmlspecialchars($_GET["file"]);
    }
    $ext = strrchr($filename, ".");
    // to hide the video file. For example: $prefix = "hide_"
    // to get the video file in a directory. For example: $prefix = "videos/"
    $prefix = "";
    $file = $prefix . $filename;

    if (($filename != "") && (file_exists($file)) && ($ext==".flv")) {
        header("Content-Type: video/x-flv");
        //header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
        
        //Be sure to post the correct Content Length.
        if ($seekat > 0) header('Content-Length: ' . (filesize($file)-$seekat));
        else header('Content-Length: ' . filesize($file));
        
        if ($seekat != 0) {
            print("FLV");
            print(pack('C', 1 ));
            print(pack('C', 1 ));
            print(pack('N', 9 ));
            print(pack('N', 9 ));
        }
        $fh = fopen($file, "rb");
        fseek($fh, $seekat);
        while (!feof($fh)) {
              print (fread($fh, 16384));
              // print (fread($fh, filesize($file)));
        }
        fclose($fh);
    }
    else {
        print("&lt;html&gt;&lt;body&gt;");
        print("Page not found.");
        print("&lt;/body&gt;&lt;/html&gt;");
    }
?&gt;

Here is the view file being called
Code:
<div id="flashcontent" style="margin:0px auto;text-align:center;">
      <p>To view this video you need JavaScript enabled and the latest Adobe Flash Player installed.  <br />
        <a href="http://www.adobe.com/go/getflashplayer/">Download the free Flash Player now</a>.</p>
      <p><a href="http://www.adobe.com/go/getflashplayer/"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Download Flash Player" style="border: none;" /></a></p>
    </div>
    
    
        // &lt;![CDATA[
    
        // width of video:320, height of the video+20(for controlbar):260,
        // 9 for Flash Player 9 (for ON2 Codec and FullScreen)
        var s1 = new SWFObject("../flash/phpsflvplayer.swf","iwflash","720","564","9", "#595959");
    
        // for ExpressInstall
        s1.useExpressInstall("../flash/playerProductInstall.swf");
        s1.setAttribute("xiRedirectUrl", [removed].href);
    
        // the video file or the playlist file
        s1.addVariable("file","../flash/ct.flv");
    
         // the PHP script
        s1.addVariable("streamscript","../../video/engine/flvprovider.php");
        s1.addVariable("bufferlength","1.2");
    
        // for playlist
        s1.addVariable("thumbsinplaylist","true");
        s1.addVariable("shuffle","false");
        
        // Width and Height of the images in the playlist (new variables by PhilFlash)
        s1.addVariable("thumbimagewidth","80");
        s1.addVariable("thumbimageheight","60");
    
         // the width and the height of the video
        s1.addVariable("displaywidth","634");
        s1.addVariable("displayheight","544");
        s1.addVariable("autostart","false");
        s1.addVariable("showdigits","true");
    
         // for fullscreen
        s1.addParam("allowfullscreen","true");
        s1.addVariable("showfsbutton","true");
    
        s1.write("flashcontent");
    
        // ]]>




Theme © iAndrew 2016 - Forum software by © MyBB