代码:
<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();
问题: 视频标签在ion-content.try里面,通过javascript改变源标签的src是行不通的。这是什么解决方案??
答案 0 :(得分:1)
您必须设置src
的{{1}}属性:
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();
答案 1 :(得分:0)
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();