def set_scene(self, name: str): if "(b-roll)" in name: self.conn.call(requests.PlayPauseMedia("b-roll", False)) else: self.conn.call(requests.PlayPauseMedia("b-roll", True)) self.conn.call(requests.SetCurrentScene(name))
def load_video(self, filename: str) -> None: with self.websocket as websocket: websocket.call( requests.SetSourceSettings( self.source_name, { 'local_file': filename, 'looping': False, 'restart_on_activate': False, 'clear_on_media_end': False, }, )) websocket.call( requests.SetSceneItemProperties( {'name': self.source_name}, # Setting the bounds here means that the media will fill the canvas, # preserving its aspect ratio. bounds={ 'type': 'OBS_BOUNDS_SCALE_INNER', 'x': self.video_info.getBaseWidth(), 'y': self.video_info.getBaseHeight(), }, )) websocket.call(requests.PlayPauseMedia(self.source_name, PAUSE)) websocket.call(requests.ScrubMedia(self.source_name, 0)) websocket.call(requests.SetCurrentScene(self.scene_name))
def pause_media_source(self, source_name): logging.debug(f"OBS command: pause media source '{source_name}'.") return self.ws_call(requests.PlayPauseMedia(source_name, "pause"))
def play_video(self) -> None: with self.websocket as websocket: websocket.call(requests.PlayPauseMedia(self.source_name, PLAY))