所以我设法在我的网站上嵌入Instagram视频。我想使用我自己的按钮和Javascript函数来播放它们。这可能吗?
我在下面列出了我的示例代码,适用于YouTube和Vimeo,但不适用于Instagram。
<script language="javascript">
function playVideo(videoType)
{
var iframe = document.getElementById('video');
if(videoType== "youtube")
iframe.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
else if(videoType == "vimeo")
iframe.contentWindow.postMessage('{"method":"play"}', '*');
else if(videoType == "instagram")
alert("Don't know how to play instagram videos");
}
</script>
<a onclick="playVideo('instagram')">PLAY</a>
<br/>
<iframe id="video" src="https://instagram.com/p/vNquyLpjaZ/embed/" width=240 height=312 />