I am trying to play a video on YouTube (in iFrame) programmatically through JS. Here is the code I use to programmatically play YouTube videos:
iframe.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
However, on devices that support the YouTube play function, the video in the iFrame becomes a black screen and does not open its own video player.
How can I use the iFrame API to programmatically play a video whenever possible?
wdews source share