3

Any one knows how to detect click event of play button of iframe/video in HTML which is loaded in web-view.

in HTML Page contains like

<p><iframe width="100%" src="youtube.com/embed/uxpDa-c-4Mc"></iframe></p>

and i need to detect click event of Playvideo button in android webview.

Naitik
  • 796
  • 11
  • 32
  • Please insert a snipped of your html showing on what you want to intercept events – Dirk Horsten Dec 04 '15 at 10:19
  • in HTML Page contains like "

    " and i need to detect click event of Playvideo button in android webview.
    – Naitik Dec 04 '15 at 10:22
  • There is no way you can have access to an iFrame with contents from another origin. You may be able to cover the iFrame with a transparent div and track that but you will not be able to send clicks to the frame either – mplungjan Dec 04 '15 at 10:26

1 Answers1

-1

Give the element an id, do the following in Javascript (I am assuming you have JQuery, your question itself is lacking details in many ways as I write this right now, you should really try to give more information in order to get answers).

EDIT: My solution to the iframe/jquery issue would be to use a video element instead of an iframe. Here is how: Show Youtube video source into HTML5 video tag?

We would then continue to use the below JS/JQuery

Example JQuery:

$('play').on("click", function() {
    //Do something
});

Example with shortcut implemented:

$('play').click(function() {
    //Do something
});
Community
  • 1
  • 1
Jay Welsh
  • 496
  • 4
  • 10
  • currently in my HTML page contains like :

    and i need to detect click event of iframe (when i play video)
    – Naitik Dec 04 '15 at 10:20