How to play mp4's on Mobiles - I have *sort of* working code

Discussion in 'Programming' started by misohoni, Jan 18, 2014.

  1. #1
    I think this is a programming thing as it does work on other sites but not sure what they've coded differently.

    Example on espn.com, if you check on your mobile - the mp4 videos play.

    - I'm using JWplayer (recommeded to play on mobiles), no flash and plays/streams mp4 videos on the desktop without flash needed.
    - On some phones using Andriod, the videos play on mobiles no problem. On my standard phone, it doesn't play - but I can play espn videos no problem.

    This is code I'm using:

    <script type="text/javascript" src="jwplayer.js"></script>
    <div id="video1" class="clear" align="center"></div>
    <script type="text/javascript">
    jwplayer('video1').setup({
        height: 400,
        image: "content/1.jpg",
        autoplay: 'false',
        levels: [
            { file: "content/1.mp4", type:"video/mp4" },
          
        ],
        modes: [
            { type: 'html5' },
            { type: 'flash',  src:'/player.swf'}
        ],
        width: 800,
        ga: {
            idstring: "title",
            trackingobject: "pageTracker"
        }
    });
    $(document).ready(function() {
        prettyPrint();
    });
    </script>
    Code (markup):
    - Any ideas guys?
     
    Solved! View solution.
    misohoni, Jan 18, 2014 IP
  2. #2
    Much like <VIDEO> to get proper support you're going to need it converted into more file formats... of course, that's part of why I think HTML 5 is a bunch of idiotic bull since they're dictating to us what we can and cannot use and wasting time encoding the same data six ways to sunday.

    When you say MP4, what is the actual codec you used? MP4 (in this case) is just a container -- Are you sure it's h.264 for the video codec and AAC for the audio? Are you including a VP8+Vorbis in a WebM container as well as a Theora + Vorbis in a Ogg?

    Check the compatibility box on MDN for more on what you should be including... generally speaking you should have at LEAST three files:

    h.264 + AAC in MP4 container, mime-type video/mp4
    VP8 + Vorbis in a WebM container, mime-type video/webm
    Theora + Vorbis in a OGG container, mime-type video/ogg

    Also, when you say "standard phone" -- could you be more specific? What OS? Android, iOS, other?

    Of course since you're relying on script-tard bull, if your handheld doesn't support javascript JWPlayer offers NO graceful fallbacks, which is why some really cheap less capable non-android non-iOS phones won't play anything you do with it. That's why you're SUPPOSED to build the markup yourself ; kind-of the whole POINT of OBJECT, AUDIO and VIDEO... You're supposed to enhance it with scripting, not generate it from scripting.
     
    deathshadow, Jan 19, 2014 IP
    ryan_uk likes this.
  3. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #3
    wow thanks, completely forgot about webm format and searching around I found this:
    http://www.longtailvideo.com/suppor...h-v5/22420/embedding-with-webm-and-mp4-source

    Where I missed off this under my mp4 from the code above:
    { file: "content/1.webm", type:"video/webm" },
    Code (markup):
    - However the site above works great on my Coolphone phone with Andriod/no flash installed (I'm guessing I was watching the webm format).

    Converting and trying it for my own video didn't work. I paid attention to the h264 and vp8 (as well as audio codecs) but it still doesn't work! I even checked the ratio conversion size and still not works either.

    Any other ideas? I didn't have my test page as html5, I changed it but still doesn't work. *Note works fine on a desktop but the mobile version says "unable to load video".*
     
    misohoni, Jan 19, 2014 IP
  4. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #4
    Ok I also found this...If I convert an mp4 mobile to mp4 codec instead of h.264 - then it plays on my phone. However, it doesn't play on the desktop...just heads up really.
     
    misohoni, Jan 22, 2014 IP
  5. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #5
    That's why you need to include MULTIPLE files.... There's a reason that when ACTUALLY coding it without the script-tard bull you would have multiple SOURCE tags... No clue what the equivalent is in fat bloated steaming pile known as JWPlayer.
     
    deathshadow, Jan 23, 2014 IP