use webkit-playsinline in javascript

后端 未结 2 949
忘掉有多难
忘掉有多难 2021-01-14 16:53

How do I use webkit-playsinline in javascript instead of in html5 video tag? I want to use it just like using video tag control/autoplay attribute in javascript or if you gu

2条回答
  •  太阳男子
    2021-01-14 17:32

    You can do this without jQuery:

    var videoElement = document.createElement( 'video' );
    videoElement.setAttribute('webkit-playsinline', 'webkit-playsinline');
    

    You have to activate this functionality in your iOs application's WebView :

    webview.allowsInlineMediaPlayback = true;
    

    You can check this post for more details:

    HTML5 inline video on iPhone vs iPad/Browser

提交回复
热议问题