How to handle YouTube video events (started, finished, etc) in uiwebview iOS -


currently i'm using new iframe api embed youtube video inside uiwebview on ipad , i've been able make auto play without user interactions. in iframe api described how use onstatechange event in application doesn't seem work , unfortunately can't see debug in uiwebview.

i want able able detect when video ends, have got advice on it? has got work?

have tried (from documentation) assign integer event of movie ending?:

onstatechange event fires whenever player's state changes. data property of event object api passes event listener function specify integer corresponds new player state. possible data values are:

-1 (unstarted) 0 (ended) 1 (playing) 2 (paused) 3 (buffering) 5 (video cued). 

when player first loads video, broadcast unstarted (-1) event. when video cued , ready play, player broadcast video cued (5) event. in code, can specify integer values or can use 1 of following namespaced variables:

yt.playerstate.ended yt.playerstate.playing yt.playerstate.paused yt.playerstate.buffering yt.playerstate.cued 

so, like:

if(event.data==yt.playerstate.ended){  //do stuff here                 } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -