Listen to vimeo Player events using JavaScriptInterface in Android

282 Views Asked by At

I am displaying a vimeo player inside a WebView on Android. My question is:I need track the "play" event and "pause" event or even the "progress of the video" using JavaScriptInterface how can I achieve this ?

1

There are 1 best solutions below

0
On

You can find a full implementation here. You can also get the embed html for a video using the vimeo-networking-java SDK. But the part you need to know is:

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');
               }
           });