Reputation: 41
Code :
<video id='play_video' controls="controls" width="100%" height="100%" autoplay="autoplay" webkit-playsinline="webkit-playsinline" class="videoPlayer">
<source id='mp4Source' src="" type="video/mp4"/>
</video>
Javascript
var player = document.getElementById('play_video');
var mp4Vid = document.getElementById('mp4Source');
mp4Vid = "http://scontent-lht6-1.cdninstagram.com/t50.2886-16/10951700_1534409696814630_381716634_n.mp4";
player.load();
player.play();
Issue: video tag is inside ion-content.try to change the src of source tag via javascript is not working. what is the solution for this??
Upvotes: 0
Views: 687
Reputation: 2294
You have to set the src
attribute of the element
:
var player = document.getElementById('play_video');
var mp4Vid = document.getElementById('mp4Source');
mp4Vid.src = "http://scontent-lht6-1.cdninstagram.com/t50.2886-16/10951700_1534409696814630_381716634_n.mp4";
player.load();
player.play();
<video id='play_video' controls="controls" width="100%" height="100%" autoplay="autoplay" webkit-playsinline="webkit-playsinline" class="videoPlayer">
<source id='mp4Source' src="" type="video/mp4"/>
</video>
Upvotes: 1
Reputation: 718
var player = document.getElementById('play_video');
var mp4Vid = document.getElementById('mp4Source');
mp4Vid.src = "http://scontent-lht6-1.cdninstagram.com/t50.2886-16/10951700_1534409696814630_381716634_n.mp4";
player.load();
player.play();
Upvotes: 0