Search code examples
htmlhtml5-videojwplayerjwplayer6

Jw player Video not auto starting on Mobile devices


Hi I am using the jwplayer to generate the video for my website. Video is autoplaying on web browsers but for mobile device its not auto playing and loading showing there. Script used to setup jwplayer is below:

version: 6.11

Here are the setting for the player

_player = jwplayer('dv_VideoPlayerUrl').setup({
            'id': 'playerID',
            'width': '100%',//options.width,
            'height': '100%',// options.height,
           'file': "my .mp4 file here",
            'streamer': ((isAndroidStream) ? filePath : ''),
            'flashplayer': '../../Scripts/JWPlayer/jwplayer.flash.swf',
            'html5player': '../../Scripts/JWPlayer/jwplayer.html5.js',
            'primary': 'flash',
            'autostart': 'true',

What is wrong with this script that my video not auto playing on mobile device.

How can I fix this issue?

Screen showing here on mobile devices. http://s27sandboxcdn.social27.com.s3.amazonaws.com/temp1.jpg


Solution

  • It is not recommended to have autostart for mobile device.

    As @MisterNeutron mentioned

    mobile devices won't autostart for very good reasons - expensive bandwidth, and not wanting to have a noisy video start playing while you're in a meeting, restaurant, etc. On most sites, I'd like to ban autostart videos even on desktop machines

    Also Mobile device does not support the auto start, see below

    How to autoplay HTML5 mp4 video on Android?

    Can you autoplay HTML5 videos on the iPad?

    enable-autoplay-html5-video-in-chrome

    Even if use onReady API of jwplayer to play() function

    jwplayer().onReady(function() { 
        jwplayer().play();
        }
    

    it will not work without touch event in mobile device.There could be workaround for this where you provide an overlay over video player or keep a play button, only for mobile devices, where user will be asked to click on button and onclick you can play the jwplayer.

     $(document).ready(function() {
        $("#video1").bind("click", function() {
         jwplayer().play();
        });
    }); 
    

    Anyways, jwplayer itself have this functionality where user clicks on video to play without autostart.

    I am just giving you various options to pick from, select whichever is convenient to your project.