Inserting HTML5 video using JavaScript for iPad

前端 未结 3 1636
误落风尘
误落风尘 2020-12-28 22:10

I am trying to insert a video into HTML using jQuery for iPad but all I see is a black screen. If I add the video tag directly to the HTML page all seems to work fine.

3条回答
  •  天涯浪人
    2020-12-28 23:02

    There is a bug in iPad's webkit that prevents dynamically created video elements from loading properly.

    To get around this set the source attribute and call the video elements load method after you have set the html

    var html = "";
    html += '';
    $("#videoDiv").html(html);
    
    $('#someVideo').attr('src', url);
    $('#someVideo')[0].load();
    

提交回复
热议问题