You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @montyz ... this seems to be a browser problem, depending also on the time, when the slide with the video gets loaded, if it is the first, then the browser might prevent the loading. I got the following result
And setting muted as a parameter in the tag does not seem to fix this either.
However, there is a way, how you can implement the desired behavior. LiaScript can execute scripts as well. You can either add this script to every slide, where you want to autoplay videos.
<script>// select all tags of type video, where the property autoplay is setconstvideos=document.querySelectorAll('video[autoplay]');for(letvideoofvideos){// set mute manually to true, otherwise autoplay will be forbiddenvideo.muted=truevideo.play()}// by returning undefined, this script will be invisible to the user// it means, no body ...undefined</script>
or you can create a custom macro, which has to be defined in the main-comment of your document:
<!--author: ...@autoplay<script>// select all tags of type video, where the property autoplay is setconst videos = document.querySelectorAll('video[autoplay]');for(let video of videos) { // set mute manually to true, otherwise autoplay will be forbidden video.muted = true video.play()}// by returning undefined, this script will be invisible to the user// it means, no body ...undefined</script>@end--># Title
...
## Wildlife
!?[Deer](pics/Deer.mp4)<!-- muted="true" -->
!?[Bears](pics/107.mp4)<!-- autoplay muted="muted" -->
!?[Doves](pics/Doves.mp4)<!-- autoplay muted="muted" -->![wildflowers](pics/IMG_2190.jpeg)@autoplay
The script will only autoplay vidoes, where the specific attribute has been added, all others will be ignored ...
See https://liascript.github.io/course/?https://raw.githubusercontent.com/montyz/landstewards/main/slides.md#7 for an example of trying to autoplay mp4 files. On my chrome or brave browser on OS X it won't autoplay. It does work in Safari and Firefox.
The text was updated successfully, but these errors were encountered: