From 6e8556081799d573594cbd95253184ba508c7819 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 13 Aug 2022 17:04:41 +1000 Subject: [PATCH] doc: linux workaround for ended event in video tag --- website/docs/guides/linux.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 website/docs/guides/linux.mdx diff --git a/website/docs/guides/linux.mdx b/website/docs/guides/linux.mdx new file mode 100644 index 00000000..c23c0f34 --- /dev/null +++ b/website/docs/guides/linux.mdx @@ -0,0 +1,20 @@ + +# Linux + +This page has miscellaneous guides related to developing Wails applications for Linux. + +## Video tag doesn't fire "ended" event + +When using a video tag, the "ended" event is not fired when the video is finished playing. This is a bug +in WebkitGTK, however you can use the following workaround to fix it: + +```js +videoTag.addEventListener("timeupdate", (event) => { + if(event.target.duration - event.target.currentTime < 0.2) { + let ended = new Event("ended"); + event.target.dispatchEvent(ended); + } +}) +``` +Source: [Lyimmi](https://github.com/Lyimmi) on the +[discussions board](https://github.com/wailsapp/wails/issues/1729#issuecomment-1212291275) \ No newline at end of file