python实现双屏同时播放视频_video.js 一个页面同时播放多个视频的实例代码

具体代码如下所述:

$(data).each(function(i, item) {

// innerHTML += '

'+

// ''+

// '

'+item.name+'

'+

// '

';

innerHTML += '

' +

// ''+

'' +

'' +

'

' + item.name + '

' +

'

';

//视频实时播放

setTimeout(function() {

var myPlayer = videojs('example_video_' + item.id);

videojs('example_video_' + item.id).ready(function() {

var myPlayer = this;

myPlayer.play();

});

}, 5000);

});

引入video.css 和video.js 为前提

调用主要是

setTimeout(function() {

var myPlayer = videojs('example_video_' + item.id);

videojs('example_video_' + item.id).ready(function() {

var myPlayer = this;

myPlayer.play();

});

}, 5000);

需要做个延时,避免加载失败

总结

以上所述是小编给大家介绍的video.js 一个页面同时播放多个视频的实例代码,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Pygame 1.9.6中,使用`pygame.movie`模块来播放视频。要循环播放多个视频,您可以使用`pygame.time`模块来计时,并在一个视频播放结束后立即开始播放一个视频。以下是一个示例代码,它可以循环播放两个视频文件: ```python import pygame import os # 初始化Pygame pygame.init() # 设置窗口大小 screen = pygame.display.set_mode((640, 480)) # 加载两个视频文件 video_files = ["video1.mp4", "video2.mp4"] videos = [] for file in video_files: videos.append(pygame.movie.Movie(file)) # 播放一个视频 current_video = 0 videos[current_video].play() # 设置计时器 clock = pygame.time.Clock() play_next = False play_time = 0 play_interval = 5000 # 每个视频播放5秒钟 # 循环播放视频 while True: # 处理事件 for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit() # 绘制视频 if videos[current_video].get_busy(): videos[current_video].set_display(screen, pygame.Rect(0, 0, 640, 480)) pygame.display.update() else: play_next = True # 检查是否需要播放一个视频 if play_next: # 等待一段时间 if play_time == 0: play_time = pygame.time.get_ticks() elif pygame.time.get_ticks() - play_time > play_interval: # 播放一个视频 current_video = (current_video + 1) % len(videos) videos[current_video].play() play_next = False play_time = 0 # 控制帧率 clock.tick(30) ``` 在上面的示例代码中,我们使用了`pygame.movie.Movie`来加载视频文件,并使用`set_display`方法来设置视频的显示位置。我们还使用了`pygame.time.get_ticks`来获取当前的时间,并使用它来计算视频播放的时间间隔。当一个视频播放完成后,我们使用`current_video = (current_video + 1) % len(videos)`来计算下一个播放视频。最后,我们使用`clock.tick(30)`来控制帧率,以确保视频流畅播放
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值