Skip to content

Commit 4173c76

Browse files
committed
Fix issue not looping with one video
This can also happen if there are two entries with the same path
1 parent 4e2c565 commit 4173c76

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/media-playlist-source.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,12 @@ static void update_media_source(void *data, bool forced)
215215
mps->actual_media = mps->current_media;
216216
}
217217

218+
// if path is same, we have to force restart it, otherwise it doesn't restart
219+
bool old_is_url = !obs_data_get_bool(settings, S_FFMPEG_IS_LOCAL_FILE);
220+
const char *old_path_setting = old_is_url ? S_FFMPEG_INPUT : S_FFMPEG_LOCAL_FILE;
221+
const char *old_path = obs_data_get_string(settings, old_path_setting);
222+
bool should_restart = strcmp(old_path, mps->actual_media->path) == 0;
223+
218224
//bool current_is_url =
219225
// !obs_data_get_bool(settings, S_FFMPEG_IS_LOCAL_FILE);
220226
const char *path_setting = mps->actual_media->is_url ? S_FFMPEG_INPUT : S_FFMPEG_LOCAL_FILE;
@@ -231,6 +237,10 @@ static void update_media_source(void *data, bool forced)
231237
obs_data_set_int(settings, S_SPEED, mps->speed);
232238
obs_source_update(media_source, settings);
233239
mps->user_stopped = false;
240+
241+
if (should_restart) {
242+
obs_source_media_restart(media_source);
243+
}
234244
}
235245

236246
obs_data_release(settings);

0 commit comments

Comments
 (0)