From 014f328dc980c5db6e32a4de3ffa55e66c86fe7a Mon Sep 17 00:00:00 2001 From: Eric Maryea Date: Fri, 25 Oct 2024 03:35:34 -0400 Subject: [PATCH] feat(ffmpeg): add playback complete event trigger (#7119) --- docs/details/libs/ffmpeg.rst | 7 +++++++ src/libs/ffmpeg/lv_ffmpeg.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/docs/details/libs/ffmpeg.rst b/docs/details/libs/ffmpeg.rst index 3fd113c47..1bcc3f930 100644 --- a/docs/details/libs/ffmpeg.rst +++ b/docs/details/libs/ffmpeg.rst @@ -40,6 +40,13 @@ See the examples below. .. _ffmpeg_example: +Events +------ + +- :cpp:enumerator:`LV_EVENT_READY` Sent when playback is complete and auto-restart is not enabled. + +Learn more about :ref:`events`. + Example ------- diff --git a/src/libs/ffmpeg/lv_ffmpeg.c b/src/libs/ffmpeg/lv_ffmpeg.c index 90619dd38..6e19be927 100644 --- a/src/libs/ffmpeg/lv_ffmpeg.c +++ b/src/libs/ffmpeg/lv_ffmpeg.c @@ -817,6 +817,9 @@ static void lv_ffmpeg_player_frame_update_cb(lv_timer_t * timer) if(has_next < 0) { lv_ffmpeg_player_set_cmd(obj, player->auto_restart ? LV_FFMPEG_PLAYER_CMD_START : LV_FFMPEG_PLAYER_CMD_STOP); + if(!player->auto_restart) { + lv_obj_send_event((lv_obj_t *)player, LV_EVENT_READY, NULL); + } return; }