gpt4 book ai didi

jquery - 使用 JavaScript 同时运行两个视频

转载 作者:行者123 更新时间:2023-12-01 07:07:35 26 4
gpt4 key购买 nike

我想在单击使用 JavaScript 创建的播放按钮后同时运行两个视频:https://jsfiddle.net/Lrt7nqyn/

目前,仅播放其中一个视频。

 <div class="player">
<div class="mediaplayer">
<video id="video1">
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" />
</video>
<video id="video2">
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" />
</video>
</div>
<table>
<tr>
<th>Time</th>
<td>
<input class="time-slider" type="range" disabled value="0" step="any" />
</td>
</tr>
<tr>
<td>
<input value="Play" type="button" class="play" />
</td>
</tr>
<tr>
<td>
<input value="Stop" type="button" class="pause" />
</td>
</tr>
<tr>
<th>Mute</th>
<td>
<input class="muted" type="checkbox" />
</td>
</tr>
<tr>
<th>Volume</th>
<td>
<input class="volume-slider" type="range" value="1" max="1" step="0.01" />
</td>
</tr>
</table>
</div>

最佳答案

试试这个:

JSfiddle:https://jsfiddle.net/1co0x58v/

$('input.play', player).bind('click',function () {
$('video, audio', player)[0].play();
$('video, audio', player)[1].play(); // add this line to play second video
});
$('input.pause', player).bind('click',function (){
$('video, audio', player)[0].pause();
$('video, audio', player)[1].pause(); // add this line to pause second video
});

关于jquery - 使用 JavaScript 同时运行两个视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37158000/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com