0

目前我正在使用这段代码:

...
from vlc import Instance as vlcInstance, MediaList, MediaParseFlag, MediaListPlayer, Event, EventType, State
...
self.player = MediaListPlayer(vlcInstance(options))
...
        self.list = MediaList(self._mrls)
        self.player.set_media_list(self.list)
...
        media = self.player.get_media_player().get_media()
        if media.get_meta(1) is not None and self.trackChangedEventCallback is not None:
            self.trackChangedEventCallback(
                media.get_meta(0),  # Title
                media.get_meta(1),  # Artist
                media.get_meta(6),  # Description
                media.get_meta(10), # URL
                media.get_meta(15)  # Artlink
            )
        print(media.get_mrl()) # MRL
...
self.player.play()
...

但它需要播放媒体,但我只想要元信息和MRL。我也试过这个而不是self.player.play()

        media = self.list.item_at_index(0)
        media.parse_with_options(MediaParseFlag.network, -1)
        sleep(2)
        print(media.get_mrl())

但它不起作用。

那么我该如何实现呢?我需要它来创建 OBS 脚本以在流式传输时播放音乐。

可能重复:从 YouTube、SoundCloud 和其他平台获取元数据和 MRL

4

0 回答 0