Foolish Coder
Foolish Coder

Reputation: 405

Why this JW player code not working in Android?

I am using following code to display a player in my site.

<div id="tv_wrapper">
    <script src="http://jwpsrv.com/library/JMFubNs4EeO+BCIACmOLpg.js"></script>
    <?php 
        $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
        if(stripos($ua,'android') !== false) {
        ?>
            <video id="video1" preload='' poster="http://EXAMPLESITE.com/wp-content/uploads/2015/06/EXAMPLESITE-card.jpg" width="100%" onclick="playVideo();" >
                <source src="http://livestream.5centscdn.com/EXAMPLESITEtv/347697d21cd084a1796ce3ca18943611.sdp/playlist.m3u8" type="video/mp4" />
            </video>
    <?php
        }
            else
        {   ?>
            <div id='playerQBUYpNLOBqmK'></div>
            <script type='text/javascript'>
                jwplayer('playerQBUYpNLOBqmK').setup({
                    file:'http://livestream.5centscdn.com/EXAMPLESITEtv/347697d21cd084a1796ce3ca18943611.sdp/playlist.m3u8',
                    //stretching: "exactfit",
                    image: 'http://EXAMPLESITE.com/wp-content/uploads/2015/10/newlogowithSlogon_jey1.png',
                    title: '',
                    autostart: false,
                    width: "100%",
                    //aspectratio: "12:5"                           
                    aspectratio: "1.8:1"
                });
            </script>
<?php   }   ?>
</div>

The player works fine in desktop firefox and in google chrome. Why it does not work on android mobile or in android tab?

I did not check it in Apple products.

Upvotes: 0

Views: 585

Answers (2)

Francesco
Francesco

Reputation: 1148

It's important that you use Chrome for Android, because HLS is not yet supported by Firefox for Android (& jwplayer v.6 or v.7)

Upvotes: 2

jolumg
jolumg

Reputation: 744

Depending of you version of jwplayer you might need to use this property:

androidhls: true;

Like this:

 jwplayer('playerQBUYpNLOBqmK').setup({                      file:'http://livestream.5centscdn.com/EXAMPLESITEtv/347697d21cd084a1796ce3ca18943611.sdp/playlist.m3u8',
                    image: 'http://EXAMPLESITE.com/wp-content/uploads/2015/10/newlogowithSlogon_jey1.png',
                    title: '',
                    autostart: false,
                    width: "100%",
                    androidhls: true,
                    aspectratio: "1.8:1"
                });

Upvotes: 2

Related Questions