Video/Image player for streaming content needed

Discussion in 'Web Design and Development' started by sk3pt1c, Oct 11, 2013.

  1. sk3pt1c macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #1
    Hello,

    We have videos and images coming to us from a content provider that don't have a file extension (e.g. .jpg, .mp4 etc).

    The need is for a gallery type slider that can load and play both types of files.

    Everything I've found so far relies either on the file extension or strings in the URL to play the media item in a defined way, most players have a playYoutube() or playVimeo() function for the videos.

    Do you know of any players that could play our sort of files?

    Been looking all day and i can't find anything, sadly :(
     
  2. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #2
    Extensions are for humans, it is wise to detect/use mime type instead.

    In PHP here are two approaches you can take on most LAMP setups:

    1) Install this pear package or ask our webhost to do it: http://pear.php.net/package/MIME_Type then read the documentation there.

    2) Use PHP's exec command and pass full path of $filename to your *nix or Mac server and get back the info you need, i.e. (untested code to show you the concept, you edit and customize):

    PHP:
    $output=array();
    exec ("file -b --mime-type $filename"$output,1);
    print_r($output
    Once you have the MIME TYPE you can rename the file with extension if needed. For a mapping of extensions to MIME TYPES go here: http://webdesign.about.com/od/multimedia/a/mime-types-by-file-extension.htm (RFC-2046)

    -jim
     
  3. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #3
    Thanks for that, will have to look into it.

    Thing is though, i tried just adding a .jpg to a URL i know is an image and i get nothing back
     
  4. SrWebDeveloper, Oct 12, 2013
    Last edited: Oct 12, 2013

    SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #4
    Um, I take it you wrote that before looking into it. You can't just add an extension to any file and expect it to work, maybe it's a GIF or PNG or something else, or the format is hosed (incomplete file, missing or wrong mime type). The mime type follows RFC-2046 which is a two part file format embedded in the file that determines what it is, regardless of the extension, for purposes of file transfer and application association. The methods I gave you are to detect this format so you can map the proper extension in your own code. If no mime type is detected, or not what you expected report back an error to the user the format is invalid, unsupported or undetected, etc.
     
  5. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #5
    No, i mean i know for sure it's a jpg and adding the extension doesn't work. The biggest problem is with videos actually, there we might be able to use something like you suggested, although i think they send mp4 wrapped in flv so that won't do us much good when the players are trying to figure out what to display
     
  6. SrWebDeveloper, Oct 12, 2013
    Last edited: Oct 12, 2013

    SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #6
    RE: JPG - beyond what I said in my first sentence of my previous reply which really did answer your question, can you see the image on your Mac via icon view or preview or any graphics editor to confirm/check format?

    RE: Video - FLV and MP4 are actually two different file formats, and since Flash is slowly being deprecated by developers due to its proprietary nature, the wide support for HTML5 and most notably lack of support of Flash on many popular mobile devices, it is wise to use MP4 via HTML5 with Flash fallback. You might want to explore using Brightcove or similar third party video CDN/cloud/API vendors to handle things or simply download and install VideoJS which is an open source Javascript framework that also handles the player and proper deprecation.

    Here is a link for an app to convert FLV to MP4 on your Mac: http://www.appgeeker.com/how-to/convert-flv-to-mp4-mac.html
     
  7. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #7
    If you just make up a URL by adding four characters to the end it will likely not exist and you get nothing.

    If you have a Unix-like OS (including Mac OS X) then you can always use the "file" command to determine what kind of file you have. The command has been around a long time (from Nov 1973 according to the manual page.) and has been improved over the years and can figure out almost any file now.

    The file command is included with every version of Mac OS X. Try it and see if it can't figure out your files. File can output either human readable text or MINE strings.
     
  8. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #8
    Thank you both, i'll try your suggestions tomorrow and get back to you
     
  9. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #9
    Is there an echo in here? I already noted the file command in my first reply, even included example code. And I already commented on adding an extension doesn't mean it'll work as well. I'm not upset about it, I'm easy going. But if you keep up stuff like that someone will take it the wrong way and it won't be pretty for you or the forum. But we all appreciate your participation and enthusiasm, including me. FYI, not a complaint.
     
  10. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #10
    let me provide an actual example, this is a video, is there any way you can get it to play in anything other than a flash player?

    EDIT: this is an image
     
  11. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #11
    On your computer, yes, but as streamed in native format to a client browser you cannot control the file association on the client side. Better to follow the advice given in my previous reply #6.
     
  12. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #12
    you tried it on your computer with an html 5 player and it worked? cause i can't get it to work on mine
     
  13. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #13
    I think you're confusing a local app vs. streamed to a client browser.

    Sure, I was able to view the FLV with either VLC or Adobe Media Player, for example. But that has nothing to do with HTML5, and is not streaming it on the Internet to a browser/client player. Refer to #6 as I said earlier for *that*.
     
  14. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #14
    i didn't mean with an application on your computer, i meant in an html player on your browser (on your computer)
     
  15. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #15
    As you asked "is there any way you can get it to play" I thought you were indirectly asking me if the FLV was invalid or bad format. It's fine, btw.

    Okay, let's step back, re-establish what you need to know and what to do in summary in context to streaming via YOUR web site:

    1) FLV is a proprietary format for Flash players ONLY browser plugin.
    2) Flash in general is not supported on mobile devices and is slowly being deprecated also due to the fact it is proprietary which is limiting.
    3) HTML5 video tags do not support the FLV file format.

    So, if you want to play an FLV then the only options you have are Flash based:

    • Use an online FLV player and embed that into your HTML.
    • Create your own FLV player in Flash.
    • Convert the FLV to a SWF and use a SWF player (or create your own in Flash)

    Personally, as I stated before, I'd convert the FLV to an MP4 and use VideoJS which is a fantastic cross browser supported HTML5 solution with an excellent API to control its behavior, plugin availability, skin support and fallback support for Flash.

    So of course I didn't test on an "HTML5 player" on my end, this is your web site, your content, and your users. You've been given the advice on how to set that up and why, and to confirm the FLV file itself is in good order.

    The rest is up to you implement via code in your web page(s). Cheers.

    :)
     
  16. sk3pt1c thread starter macrumors 6502a

    sk3pt1c

    Joined:
    Nov 29, 2005
    Location:
    a simulacrum
    #16
    OK, thank you! :)
     

Share This Page