How to play video from youku using javascript ?
I tried to do like this but not work, how can i do that ?
<iframe id="test" src="https://player.youku.com/embed/XMjUzMzY2ODQ4OA==" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="" style="position: absolute; top: 0; left: 0; width: 50%; height: 50%;"></iframe>
<div style=" position: fixed; top: 56%; " onclick="play_fn()">Play</div>
<script>
function play_fn(){
var test = document.getElementById('test');
test.play();
}
</script>
play()is a method found on<video>and<audio>elements. An<iframe>is just a means to embed a URL in a page. It provides no API for playing media.Unless youku provide an API that you can access (I couldn't find one with a quick search), then there is no way to trigger playback from your page.
Standard cross origin security restrictions imposed by browsers prevent you manipulating the embedded page with JavaScript.