def play_sound(): mediaSource = S.obs_source_create_private("ffmpeg_source", "Global Media Source", None) s = S.obs_data_create() S.obs_data_set_string(s, "local_file", script_path() + "alert.mp3") S.obs_source_update(mediaSource, s) S.obs_source_set_monitoring_type(mediaSource, S.OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT) S.obs_data_release(s) S.obs_set_output_source(outputIndex, mediaSource) return mediaSource
def script_unload(): obs.obs_set_output_source(outputIndex, None)
def play_sound(media_path: str, monitoring_type: int = obs.OBS_MONITORING_TYPE_MONITOR_ONLY): with media_source_ar(media_path, monitoring_type) as media_source: obs.obs_set_output_source(63, media_source)