Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Forced Download and Web Win Media Player

  1. #1
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default Forced Download and Web Win Media Player

    Okay, so I have a script which pulls up windows media player in the web page. It's suppose to load a video from a force download script in PHP and play it, but for some reason this only works in IE. What might I do to make it work in other browsers?
    (Sorry for not sharing the script, but I'd rather not at this point for security reasons; if you need it I can water it down for you).
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can't force anything upon a user, really. You can only do that within certain programs, like IE.

    But there's one method I can think of-- require a certain player then apply it to that player.

    So, here's what you do-- use mms:// instead of http://... that's one method that only allows streaming in a player as far as I know.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Quote Originally Posted by djr33 View Post
    You can't force anything upon a user, really. You can only do that within certain programs, like IE.

    But there's one method I can think of-- require a certain player then apply it to that player.

    So, here's what you do-- use mms:// instead of http://... that's one method that only allows streaming in a player as far as I know.
    DJR33: Thanks for the reply. I'm not sure you understand, though. This one is my fault-- I typed the post in a rush. Sorry.

    "Force Download" does not mean that you litterally make the user download the file; it means that it forces the browser to display a save dialogue box. (i.e. if you did this with an image, instead of the image being displayed in the browser, it would ask you save the image to your computer-- it's what happens when you DL something from sourceforge, for another example).

    In this case, I want to use the script like an actual video file, because as far as web browsers are concerned, there is not difference between "myvideo.wmv" and "myscript.php?video=67". That is, instead of src="myvideo.wmv", it would be src="myscript.php?video=67". Again, it works with IE, but nothing else. The error that windows media player shows is that it could not retrieve file the contents.

    So, to your answer: I'm not using the full path, for one, so I don't think the mms will work. If you think it will, I could use more info on it.
    Last edited by Jas; 01-21-2008 at 12:41 AM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    And what do you do for the visitors that don't have Windows Media Player installed?

    The best bet would be to create the video in a more universal format and let the visitor play it in what ever player they want (or have set as default).
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You can send a force-download header to the browser using PHP. Just set the type of file being output with the header. But that isn't reliable, especially in IE (guess that's ironic).

    You can use a PHP file to output that without much trouble.

    readfile($_GET['file']);
    ...something like that.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    BLiZZaRD: The fact is that most users do have it installed. And if they don't, they can DL the file and view it in another player. I do hope to get different online players eventually, but right now one is all I can handle.

    djr33: Thanks! The headers have only been working in IE.
    I was trying to get to sleep last night, and I thought "Why don't I just try a readfile with no headers?" But I didn't know if that was worth trying. And then I come here, and you suggested it, so now I think it is worth I try! I'll let you know how it turns out.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    That should probably work. Using headers can be tough because there is a lot of info out there, and not all of it is right. There is no actual force-download header, in fact. That's just a null header because it doesn't exist, so it defaults to downloading as it doesn't know what to do with it. So, you can use that and hope it errors to downloading, or you can set another type. I'm not quite sure what the best procedure is.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    It did not work. It went well in IE again, but not in FF or Opera (didn't bother to try netscape or safari). There has to be a way to make it work. Perhaps the player has a problem with the .php?file=1 extension-- maybe it won't work unless it's .wmv or .avi or .mpeg. But then why does it work in IE? I am starting to think I should just give up and make the user DL the file.
    Any other ideas djr33?
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I think I misread something you said before, and I've been giving backwards advice.
    You WANT to embed this, and NOT force download it?
    You should just then give the proper header, which will be a windows media file, either wmv or avi.
    Take a look at this post, specifically the response for avi:
    http://www.php.net/manual/en/function.header.php#48538
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I have a script very much like the one you linked to, and it didn't work for embedding. The files download great-- which is the intention of the script-- but for some reason they don't want to embed in WMP.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

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
  •