2
我在Android上的WebView內顯示vimeo播放器。 我的問題是:我需要使用JavaScriptInterface跟蹤「play」事件和「暫停」事件,甚至是「視頻進度」,我該如何實現這一目標?在Android中使用JavaScriptInterface收聽vimeo Player事件
我在Android上的WebView內顯示vimeo播放器。 我的問題是:我需要使用JavaScriptInterface跟蹤「play」事件和「暫停」事件,甚至是「視頻進度」,我該如何實現這一目標?在Android中使用JavaScriptInterface收聽vimeo Player事件
您可以找到完整的實施here。您還可以使用vimeo-networking-java SDK獲取視頻的嵌入html。但你需要知道的部分是:
froogaloop.addEvent('playProgress', function(data) {
if(!showingPlayer && data.percent > 0) {
showingPlayer = true;
jQuery('.froog_container_class').show();
jQuery('.froog_container_class').css('height', '_windowHeight');
jQuery('.froog_container_class').css('width', '_windowWidth');
/* Most tablets I tested aren't quick enough to make this work
but one can still hope */
jQuery('#loading').fadeOut('slow');
}
});