Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default Serving FLV via PHP - anyone know how?


    Serving FLV via PHP, does anyone know?
    PHP Code:
    $file 'video-file.flv';
    header('Content-Type: video/x-flv');
    echo 
    file_get_contents($file);
    die(); 
    it doesnt work... im using jwPlayer to play the video....

    this

  2. #2

  3. #3
    try flash player sa macromedia dreamwear... naa rana didto .. drag and drop and path sa file name.

  4. #4
    Quote Originally Posted by jakeneuman View Post
    Quote Originally Posted by emailroy2002 View Post
    try flash player sa macromedia dreamwear... naa rana didto .. drag and drop and path sa file name.


    not what im lookin, its like this...

    instead of using -
    http://www.site.com/video/video.flv

    i will use -
    http://www.site.com/video.php?id=xxx

    in this way you can disallow direct access and hot linking on the video, or bandwidth-stealing

    this is similar to most streaming websites...

    this is the reason why i use this header -
    PHP Code:
    header('Content-Type: video/x-flv'); 

  5. #5
    Quote Originally Posted by salbahis View Post
    Serving FLV via PHP, does anyone know?
    PHP Code:
    $file 'video-file.flv';
    header('Content-Type: video/x-flv');
    echo 
    file_get_contents($file);
    die(); 
    it doesnt work... im using jwPlayer to play the video....

    this
    bro ang main problem kay wala sa php, naa sa jwplayer. hard-coded man sa flash player kung unsaon niya pag-detect ang file type nga i-play. for example, kung .flv ang file extension, video ang i-play. kung .mp3 kay sound. so mag-depende ra jud na sa file extension.

    ang problema karon kay .php + parameters nman gud so di na siya maka-detect ug tarong kung unsay i-play bisan gi-specify pa ang content-type sa server. ang paagi ana kay naa ra ka i-add nga parameter para sa flash player: type=video.

    demo: http://www.jamesbanogon.com/code/flv/player.html - hosted ra na sa akong server, di na permanent nga url, basin next month 404 na na nga link

    then naa pud ko gamay nga tip, instead of using echo file_get_contents, you should use readfile kay mas suitable siya sa imong gusto mahitabo. mas pas2x na nga command, maka-feel ka sa kalahian labi na kung daghan kaayo gi-serve nga file unya samot na kung dagko ug file size. mao na akong gamiton basta mag-implement kog file caching para hinay sa server load.

    ang explanation ana kay kung file_get_contents, inig read niya sa file iya pa na i-return as string then kinghanlan pa nimo i-echo. ang readfile kay while reading the file, i-output na diretso. so mas paspas siya kay di nman kinghanlan i-store sa memory ang tibuok file content, then dili na pud ka kinghanlan mo-issue ug instruction para output sa content. dako kaau ug ikatabang na nga kalahian system memory-wise & cpu cycle-wise.

  6. #6
    Quote Originally Posted by darkhero View Post
    bro ang main problem kay wala sa php, naa sa jwplayer. hard-coded man sa flash player kung unsaon niya pag-detect ang file type nga i-play. for example, kung .flv ang file extension, video ang i-play. kung .mp3 kay sound. so mag-depende ra jud na sa file extension.

    ang problema karon kay .php + parameters nman gud so di na siya maka-detect ug tarong kung unsay i-play bisan gi-specify pa ang content-type sa server. ang paagi ana kay naa ra ka i-add nga parameter para sa flash player: type=video.

    demo: FLV Player - hosted ra na sa akong server, di na permanent nga url, basin next month 404 na na nga link

    then naa pud ko gamay nga tip, instead of using echo file_get_contents, you should use readfile kay mas suitable siya sa imong gusto mahitabo. mas pas2x na nga command, maka-feel ka sa kalahian labi na kung daghan kaayo gi-serve nga file unya samot na kung dagko ug file size. mao na akong gamiton basta mag-implement kog file caching para hinay sa server load.

    ang explanation ana kay kung file_get_contents, inig read niya sa file iya pa na i-return as string then kinghanlan pa nimo i-echo. ang readfile kay while reading the file, i-output na diretso. so mas paspas siya kay di nman kinghanlan i-store sa memory ang tibuok file content, then dili na pud ka kinghanlan mo-issue ug instruction para output sa content. dako kaau ug ikatabang na nga kalahian system memory-wise & cpu cycle-wise.
    you dont get it.... the idea is to cloack the FLV link... so it wont be accessible directly...

    i will still use the standard jwplayer code instead i will add to the video link is in php....

    PHP Code:
    <object width="450" height="290" name="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="player">
        <
    param value="http://www.site.com/player.swf" name="movie">
        <
    param value="true" name="allowfullscreen">
        <
    param value="always" name="allowscriptaccess">
        <
    param value="file=http://www.site.com/video/video.flv&stretching=exactfit&controlbar=over" name="flashvars">
        <
    embed width="450" height="290" 
            
    flashvars="file=http://www.site.com/video/video.flv&stretching=exactfit&controlbar=over" 
            
    allowfullscreen="true" 
            
    allowscriptaccess="always" 
            
    src="http://www.site.com/player.swf" 
            
    name="player2" 
            
    id="player2" 
            
    type="application/x-shockwave-flash"/>
    </
    object
    http://www.site.com/video/video.flv- i want to replace this into http://www.site.com/video.php?id=xxx

    the idea is to load and open the flv, then return by PHP as FLV, thats why i put header content type...

    btw... this is advanced php and not very common, header manipulation...

    playlist? - dili nga solution amo pangita.... we need it to be light thats why the link should be direct as much as possible...

    i already have the code, but is not simple... still need to simplify it, unless you guys have idea that are more easy and simple...


  7. #7
    Dili pa tong sakto ang gi hatag na source code ni darkhero bro?

  8. #8
    Quote Originally Posted by salbahis View Post
    you dont get it.... the idea is to cloack the FLV link... so it wont be accessible directly...

    i will still use the standard jwplayer code instead i will add to the video link is in php....

    PHP Code:
    <object width="450" height="290" name="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="player">
        <
    param value="http://www.site.com/player.swf" name="movie">
        <
    param value="true" name="allowfullscreen">
        <
    param value="always" name="allowscriptaccess">
        <
    param value="file=http://www.site.com/video/video.flv&stretching=exactfit&controlbar=over" name="flashvars">
        <
    embed width="450" height="290" 
            
    flashvars="file=http://www.site.com/video/video.flv&stretching=exactfit&controlbar=over" 
            
    allowfullscreen="true" 
            
    allowscriptaccess="always" 
            
    src="http://www.site.com/player.swf" 
            
    name="player2" 
            
    id="player2" 
            
    type="application/x-shockwave-flash"/>
    </
    object
    http://www.site.com/video/video.flv- i want to replace this into http://www.site.com/video.php?id=xxx

    the idea is to load and open the flv, then return by PHP as FLV, thats why i put header content type...

    btw... this is advanced php and not very common, header manipulation...

    playlist? - dili nga solution amo pangita.... we need it to be light thats why the link should be direct as much as possible...

    i already have the code, but is not simple... still need to simplify it, unless you guys have idea that are more easy and simple...

    bro imo gitan-aw ang demo? naa may source code gi-apil nko. gamay ra kaau modifications kinghanlan pero basically mao ra na siya. "standard" mana jafon nga jwplayer akong gigamit. wa mana nko gi-usab ang code sa flash player. pero ako ra siya gipahibalo unsa ang type sa file nga i-play by adding type=video sa flashvars nga parameter. mao na ang problema ngano dili siya mo-play kay ang extension .php na, dili na .flv. sabta mau akong explanation sa previous post bro then tan-awa pud ang source code. naa may link sa tibuok source code ubos sa player.

    PHP Code:
        <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
            <
    param name="movie" value="player.swf" />
            <
    param name="allowfullscreen" value="true" />
            <
    param name="allowscriptaccess" value="always" />

            <
    param name="flashvars" value="file=video.php?id=xxx&image=preview.jpg&type=video" />

            <
    embed
                type
    ="application/x-shockwave-flash"
                
    id="player2"
                
    name="player2"
                
    src="player.swf" 
                
    width="400" 
                
    height="315"
                
    allowscriptaccess="always" 
                
    allowfullscreen="true"
                
    flashvars="file=video.php?id=xxx&image=preview.jpg&type=video" 
            
    />
        </
    object
    lain nga tip, assuming nga apache ang server unya naka-enable ang mod_rewrite, pwede ra gani htaccess gamiton para pang-counter sa inline linking. di na kinghanlan ug advanced2x. pero kung ganahan jud ka moagi ana nga route, via php, well kinghanlan imo pa i-specify sa jwplayer unsa ang file type sa iyang i-play. dili na enough nga imo ra gi-send sa client ang mime type via php kay hard-coded na sa jwplayer nga ang file extension iyang basehan kung way file type nga gi-specify. meaning dili na makasabot ug content-type nga header ang jwplayer. gets?

  9. #9
    Quote Originally Posted by darkhero View Post
    bro imo gitan-aw ang demo? naa may source code gi-apil nko. gamay ra kaau modifications kinghanlan pero basically mao ra na siya. "standard" mana jafon nga jwplayer akong gigamit. wa mana nko gi-usab ang code sa flash player. pero ako ra siya gipahibalo unsa ang type sa file nga i-play by adding type=video sa flashvars nga parameter. mao na ang problema ngano dili siya mo-play kay ang extension .php na, dili na .flv. sabta mau akong explanation sa previous post bro then tan-awa pud ang source code. naa may link sa tibuok source code ubos sa player.

    PHP Code:
        <object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="315">
            <
    param name="movie" value="player.swf" />
            <
    param name="allowfullscreen" value="true" />
            <
    param name="allowscriptaccess" value="always" />

            <
    param name="flashvars" value="file=video.php?id=xxx&image=preview.jpg&type=video" />

            <
    embed
                type
    ="application/x-shockwave-flash"
                
    id="player2"
                
    name="player2"
                
    src="player.swf" 
                
    width="400" 
                
    height="315"
                
    allowscriptaccess="always" 
                
    allowfullscreen="true"
                
    flashvars="file=video.php?id=xxx&image=preview.jpg&type=video" 
            
    />
        </
    object
    lain nga tip, assuming nga apache ang server unya naka-enable ang mod_rewrite, pwede ra gani htaccess gamiton para pang-counter sa inline linking. di na kinghanlan ug advanced2x. pero kung ganahan jud ka moagi ana nga route, via php, well kinghanlan imo pa i-specify sa jwplayer unsa ang file type sa iyang i-play. dili na enough nga imo ra gi-send sa client ang mime type via php kay hard-coded na sa jwplayer nga ang file extension iyang basehan kung way file type nga gi-specify. meaning dili na makasabot ug content-type nga header ang jwplayer. gets?
    site is block on our office.... anyways, yes pwede man .htaccess, nga i block ang mo hotlink...

    if you serve flv in php, there are lot of rooms to add, like authentication before serving... pulling it out from database then authenticate internally....

    why did they even add flv mime-type if dili diay pwede?, like i said i have already made a code it works but it takes time because it is not yet optimize, im just looking for shortcuts if any...until then ill just continue using this until such shortcut is open

  10. #10
    UPDATE:

    you are right i should have use readfile, it loads faster now.... matsalams...

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. Anyone knows how to set up DSL to a Buffalo Broad Station?
    By stephanie27 in forum Computer Hardware
    Replies: 12
    Last Post: 12-29-2012, 09:18 PM
  2. Replies: 15
    Last Post: 09-15-2012, 04:51 PM
  3. Does anyone know how to remove dark spots?
    By Rianna in forum Fitness & Health
    Replies: 4
    Last Post: 06-13-2012, 11:27 PM
  4. Replies: 7
    Last Post: 04-29-2011, 04:45 AM
  5. anyone know how to run a page in ie browser??
    By Zid in forum Websites & Multimedia
    Replies: 15
    Last Post: 05-15-2006, 09:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top