player_1.py.zip

  • BTM1
    了解作者
  • Python
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-04-19 13:54
    上传日期
vlc 视频播放模块,播放视频,vlc-python
player_1.py.zip
  • player_1.py
    6.3KB
内容介绍
import vlc from time import sleep class Model_1(): def __init__(self): self.video_1_path='/home/pi/source/test_1.mp4' self.audio_1_path='/home/pi/source/test_1.mp3' self.audio_2_path='/home/pi/source/test_2.mp3' self.audio_3_path='/home/pi/source/test_3.mp3' self.audio_4_path='/home/pi/source/test_4.mp3' self.audio_5_path='/home/pi/source/test_5.mp3' self.audio_6_path='/home/pi/source/test_6.mp3' self.audio_7_path='/home/pi/source/test_7.mp3' self.audio_8_path='/home/pi/source/test_8.mp3' self.audio_9_path='/home/pi/source/test_9.mp3' self.paths=[self.videO_1_path,self.audio_1_path,self.audio_2_path,self.audio_3_path,self.audio_4_path,self.audio_5_path,self.audio_6_path,self.audio_7_path,self.audio_8_path,self.audio_9_path] self.instances=[] self.medias=[] self.media_lists=[] self.players=[] self.list_players=[] for index,path in enumerate(self.paths): print("Loading "+path) self.instances.append(vlc.Instance()) self.medias.append(self.instances[index].media_new(path)) self.media_lists.append(self.instances[index].media_list_new()) self.media_lists[index].add_media(self.medias[index]) self.list_players.append(self.instances[index].media_list_player_new()) self.list_players[index].set_media_list(self.media_lists[index]) self.list_players[index].set_playback_mode(vlc.PlaybackMode.loop) self.players.append(self.instances[index].media_player_new()) self.list_players[index].set_media_player(self.players[index]) self.players[index].audio_set_volume(50) self.players[0].set_fullscreen(True) def play(self,audio_number): if self.list_players[0].is_playing(): pass else: self.list_players[0].play() a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 if a <= 9: self.list_players[a].stop() self.list_players[audio_number].play() else: self.list_players[audio_number].play() def volume_up(self): a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.players[a].audio_set_volume(self.players[a].audio_get_volume()+10) def volume_down(self): a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.players[a].audio_set_volume(self.players[a].audio_get_volume()-10) def stop(self): self.list_players[0].stop() a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.list_players[a].stop() class Model_2(): def __init__(self): self.video_path='/home/pi/source/test_2.mp4' self.audio_1_path='/home/pi/source/test_1.mp3' self.audio_2_path='/home/pi/source/test_2.mp3' self.audio_3_path='/home/pi/source/test_3.mp3' self.audio_4_path='/home/pi/source/test_4.mp3' self.audio_5_path='/home/pi/source/test_5.mp3' self.audio_6_path='/home/pi/source/test_6.mp3' self.audio_7_path='/home/pi/source/test_7.mp3' self.audio_8_path='/home/pi/source/test_8.mp3' self.audio_9_path='/home/pi/source/test_9.mp3' self.paths=[self.video_path,self.audio_1_path,self.audio_2_path,self.audio_3_path,self.audio_4_path,self.audio_5_path,self.audio_6_path,self.audio_7_path,self.audio_8_path,self.audio_9_path] self.instances=[] self.medias=[] self.media_lists=[] self.players=[] self.list_players=[] for index,path in enumerate(self.paths): print("Loading "+path) self.instances.append(vlc.Instance()) self.medias.append(self.instances[index].media_new(path)) self.media_lists.append(self.instances[index].media_list_new()) self.media_lists[index].add_media(self.medias[index]) self.list_players.append(self.instances[index].media_list_player_new()) self.list_players[index].set_media_list(self.media_lists[index]) self.list_players[index].set_playback_mode(vlc.PlaybackMode.loop) self.players.append(self.instances[index].media_player_new()) self.list_players[index].set_media_player(self.players[index]) self.players[index].audio_set_volume(50) self.players[0].set_fullscreen(True) def play(self,audio_number): if self.list_players[0].is_playing(): pass else: self.list_players[0].play() a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 if a <= 9: self.list_players[a].stop() self.list_players[audio_number].play() else: self.list_players[audio_number].play() def volume_up(self): a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.players[a].audio_set_volume(self.players[a].audio_get_volume()+10) def volume_down(self): a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.players[a].audio_set_volume(self.players[a].audio_get_volume()-10) def stop(self): self.list_players[0].stop() a=1 for p in self.list_players[1:10]: if p.is_playing(): a=a break else: a=a+1 self.list_players[a].stop() model_1=Model_1() model_1.play(1) sleep(10) model_1.play(2) sleep(10) model_1.stop() model_2=Model_2() model_2.play(3) sleep(10) model_2.play(4) # model=Model_1() # model.play(1) # sleep(5) # model.volume_up() # sleep(5) # model.volume_down() # sleep(5) # model.play(8) # input()
评论
    相关推荐
    • vlc-matlab.zip
      建立5X5X3立方米空间内的视距传输的光照分布算法
    • vlc播放rtsp
      利用vlc请求获取rtsp流的视频,可以一个页面播放多个视频,内附vlc安装包,测试好的html页面。安装即用。(安装了vlc之后,打开安装的vlc文件夹,找到axvlc.dll这个文件,注册下这个文件。就可以播放了。不会请联系...
    • Android vlc
      好用精简的vlc源码,老鸟勿喷,供学习。
    • vlc视频直播
      VLC开发包,直接直播视频播放,推流的地址,修改一下,直接进行rtmp,rtsp,hls,http等在线直播。
    • vlc 播放器
      ffmpeg convert video formats phpcms online version exec functionProcedures php... package jmfsample; import java.io.*; import javax.media.*; import javax..
    • VLC视频播放器
      VLC多媒体播放器(最初命名为VideoLAN客户端)是VideoLAN计划的多媒体播放器。它支持众多音频与视频解码器及文件格式,并支持DVD影音光盘,VCD影音光盘及各类流式协议。它也能作为unicast或 multicast的流式服务器在...
    • wpf调用vlc
      1.添加(VLC库) packages\Vlc.DotNet.Core.2.2.1\lib\net45\Vlc.DotNet.Core.dll Vlc.DotNet.Core.Interops.dll Vlc.DotNet.Forms.dll Vlc.DotNet.Wpf.dll net45下的四个到当前项目引用 2.添加(本地库) System...
    • al-ahmadi2018vlc.rar
      vlc pour les transmissions optiques
    • vlc.zip
      plugin VLC, para stream de video
    • vlc.rar
      Reproductor vlc integrado a PB