当前位置: 首页>>代码示例>>Python>>正文


Python vlc.Instance方法代码示例

本文整理汇总了Python中vlc.Instance方法的典型用法代码示例。如果您正苦于以下问题:Python vlc.Instance方法的具体用法?Python vlc.Instance怎么用?Python vlc.Instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vlc的用法示例。


在下文中一共展示了vlc.Instance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def __init__(self, *args, **kwargs):
    Gtk.Box.__init__(self, *args, **kwargs)

    self.canvas = Gtk.DrawingArea()
    self.pack_start(self.canvas, True, True, 0)

    self.instance = vlc.Instance()
    self.canvas.connect('realize', self.on_canvas_realized)
    self.canvas.connect('draw', self.on_canvas_draw)

    self.player = self.instance.media_player_new()
    self.player.video_set_scale(0)
    self.player.video_set_aspect_ratio('16:9')
    self.player.video_set_deinterlace('on')
    self.player.video_set_mouse_input(False)
    self.player.video_set_key_input(False)

    add_widget_class(self, 'player-video') 
开发者ID:jonian,项目名称:kickoff-player,代码行数:20,代码来源:vlcbox.py

示例2: __init__

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def __init__(self):
        self.vlcInstance = vlc.Instance()
        self.player = self.vlcInstance.media_player_new()
        self.alsa = alsaaudio.Mixer(alsaaudio.mixers()[0])
        self.alsa.setvolume(self.volume) 
开发者ID:BramRausch,项目名称:PiPod,代码行数:7,代码来源:playback.py

示例3: _init_vlc

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def _init_vlc(self, resource):
        import vlc
        self._reset_state()

        for k, v in self._env.items():
            os.environ[k] = v

        self._instance = vlc.Instance(*self._args)
        self._player = self._instance.media_player_new(resource)

        for evt in self._watched_event_types():
            self._player.event_manager().event_attach(
                eventtype=evt, callback=self._event_callback()) 
开发者ID:BlackLight,项目名称:platypush,代码行数:15,代码来源:vlc.py

示例4: setup_backend

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def setup_backend(cls, vlc_opts = ['--no-video-title-show']):
        """ Prepare/check the VLC backend.

        Args:
            vlc_opts (`list`): the arguments for starting vlc

        Returns:
            `str`: the version of VLC used by the backend
        """
        if IS_WINDOWS and vlc.plugin_path:
            # let python find the DLLs
            os.environ['PATH'] = vlc.plugin_path + ';' + os.environ['PATH']

        VlcOverlay._instance = vlc.Instance(vlc_opts)
        return 'VLC {}'.format(vlc.libvlc_get_version().decode('ascii')) 
开发者ID:Cimbali,项目名称:pympress,代码行数:17,代码来源:vlc_backend.py

示例5: create_video

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def create_video(self):
        """Create video widget."""

        self.instance = vlc.Instance()

        video_widget = QFrame()
        self.mediaplayer = self.instance.media_player_new()
        if system() == 'Linux':
            self.mediaplayer.set_xwindow(video_widget.winId())
        elif system() == 'Windows':
            self.mediaplayer.set_hwnd(video_widget.winId())
        elif system() == 'darwin':  # to test
            self.mediaplayer.set_nsobject(video_widget.winId())
        else:
            lg.warning('unsupported system for video widget')
            return

        self.medialistplayer = vlc.MediaListPlayer()
        self.medialistplayer.set_media_player(self.mediaplayer)
        event_manager = self.medialistplayer.event_manager()
        event_manager.event_attach(vlc.EventType.MediaListPlayerNextItemSet,
                                   self.next_video)

        self.idx_button = QPushButton()
        self.idx_button.setText('Start')
        self.idx_button.clicked.connect(self.start_stop_video)

        layout = QVBoxLayout()
        layout.addWidget(video_widget)
        layout.addWidget(self.idx_button)
        self.setLayout(layout) 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:33,代码来源:video.py

示例6: check_dependencies

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def check_dependencies():
        """Checks whether dependencies are met for playing a player.

        Overrides method from Player; see documentation in that class.
        """
        try:
            import vlc
            i = vlc.Instance()
            vlc.libvlc_release(i)
        except (ImportError, NameError, OSError, AttributeError):
            raise PlayerDependencyError(
                "Dependency VLC not found, which is required for playing"
                " media files"
            ) 
开发者ID:xgi,项目名称:castero,代码行数:16,代码来源:vlcplayer.py

示例7: _create_player

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def _create_player(self) -> None:
        """Creates the player object while making sure it is a valid file.

        Overrides method from Player; see documentation in that class.
        """
        vlc_instance = self.vlc.Instance("--no-video --quiet")

        self._player = vlc_instance.media_player_new()
        self._media = vlc_instance.media_new(self._path)
        self._media.parse()  # may output some junk into the console
        self._player.set_media(self._media)

        self._duration = self._media.get_duration() 
开发者ID:xgi,项目名称:castero,代码行数:15,代码来源:vlcplayer.py

示例8: __init__

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def __init__(self):
        self.libvlc_Instance=vlc.Instance('--verbose 0')
        self.libvlc_player = self.libvlc_Instance.media_player_new()
        # self.libvlc_list_player = self.libvlc_Instance.media_list_player_new()
        # self.libvlc_Media_list = self.libvlc_Instance.media_list_new()
        # self.libvlc_list_player.set_media_player(self.libvlc_player)
        # self.libvlc_list_player.set_media_list(self.libvlc_Media_list)
        # self.libvlc_player_event_manager= self.libvlc_player.event_manager() 
开发者ID:shivasiddharth,项目名称:GassistPi,代码行数:10,代码来源:mediaplayer.py

示例9: play_audio_file

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def play_audio_file(self,fname):
        Instance=vlc.Instance()
        player=Instance.media_player_new()
        player.set_mrl(fname)
        player.play() 
开发者ID:shivasiddharth,项目名称:GassistPi,代码行数:7,代码来源:mediaplayer.py

示例10: on_setup

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def on_setup(self):

		parametersCommon = [
			# '--alsa-audio-device=mono'
			# '--file-logger'
			# '--logfile=vlc-log.txt'
		]

		parametersSpeech = parametersCommon

		if not platform.system() == 'Windows':

			if self.__config['sound']['output']:
				parametersSpeech.append('--aout=' + self.__config['sound']['output'])

				if self.__config['sound']['output_device']:
					parametersSpeech.append('--alsa-audio-device=' + self.__config['sound']['output_device'])

		self.vlc_instance = vlc.Instance(*parametersSpeech)
		self.player = self.vlc_instance.media_player_new()

		self.media_vlc_instance = self.vlc_instance
		self.media_player = self.player

		if not platform.system() == 'Windows':

			if self.__config['sound']['media_output']:
				parametersMedia = parametersCommon
				parametersMedia.append('--aout=' + self.__config['sound']['media_output'])

				if self.__config['sound']['media_output_device']:
					parametersMedia.append('--alsa-audio-device=' + self.__config['sound']['media_output_device'])

				self.media_vlc_instance = vlc.Instance(*parametersMedia)
				self.media_player = self.media_vlc_instance.media_player_new()

		if self.__config['sound']['default_volume']:
			self.volume = self.__config['sound']['default_volume']

		if self.__config['sound']['media_default_volume']:
			self.media_volume = self.__config['sound']['media_default_volume'] 
开发者ID:alexa-pi,项目名称:AlexaPi,代码行数:43,代码来源:vlchandler.py

示例11: OnOpen

# 需要导入模块: import vlc [as 别名]
# 或者: from vlc import Instance [as 别名]
def OnOpen(self):
        """Pop up a new dialow window to choose a file, then play the selected file.
        """
        # if a file is already running, then stop it.
        self.OnStop()

        # Create a file dialog opened in the current home directory, where
        # you can display all kind of files, having as title "Choose a file".
        p = pathlib.Path(os.path.expanduser("~"))
        fullname =  askopenfilename(initialdir = p, title = "choose your file",filetypes = (("all files","*.*"),("mp4 files","*.mp4")))
        if os.path.isfile(fullname):
            dirname  = os.path.dirname(fullname)
            filename = os.path.basename(fullname)
            # Creation
            self.Media = self.Instance.media_new(str(os.path.join(dirname, filename)))
            self.player.set_media(self.Media)
            # Report the title of the file chosen
            #title = self.player.get_title()
            #  if an error was encountred while retriving the title, then use
            #  filename
            #if title == -1:
            #    title = filename
            #self.SetTitle("%s - tkVLCplayer" % title)

            # set the window id where to render VLC's video output
            if platform.system() == 'Windows':
                self.player.set_hwnd(self.GetHandle())
            else:
                self.player.set_xwindow(self.GetHandle()) # this line messes up windows
            # FIXME: this should be made cross-platform
            self.OnPlay()

            # set the volume slider to the current volume
            #self.volslider.SetValue(self.player.audio_get_volume() / 2)
            self.volslider.set(self.player.audio_get_volume()) 
开发者ID:makelove,项目名称:Python_Master_Courses,代码行数:37,代码来源:examples_tkvlc.py


注:本文中的vlc.Instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。