Created attachment 172667 [details] PDF file with movies embedded as Screen annotations SUMMARY Screen annotations have two levels of control over whether media content is automatically played: 1. The activation of the annotation itself is controlled by the annotation's action and additional action dictionary, where the action and each entry in the additional action dictionary contain an own, possibly different, rendition action. For a movie to autoplay, an appropriate action needs to be defined in the additional action dictionary, which in most cases corresponds to the page opening event. The activation of the screen annotation corresponds to the `autoPlay` property of `Okular::Movie` objects. 2. In addition, media renditions in screen annotations have another parameter to directly control autoplay in the media player. This corresponds to the `autoPlay` property of `Poppler::MediaRendition` objects. It is worth to note that the respective entry in the PDF standard is by default set to true and rarely changed at all by PDF creators. Thus, in order to have media content play automatically, both these need to be true, where the latter, i.e. `autoPlay` in Poppler::MediaRendition, is correctly handled in `createMovieFromPopplerScreen` already by setting the `startPaused` property in `Okular::Movie` objects accordingly. The former however requires checking the additional actions of the Screen annotations, which is implemented here. Furthermore, it is worth to note that, in principle, each rendition in the additional action dictionary could play different media content. However, this is probably a rather uncommon use case and would increase the complexity of the implementation considerably. Okular has only one level of control, as far as I can tell, even though `Okular::Movie` has the two property (`startPaused` and `autoPlay`), which are sort of redundant with respect to how Okular handles movies. Thus, one could even get rid of the `startPaused` property altogether. I have attached a patch which is completely untested, and is more meant to demonstrate how the autoplay for movies in Screen annotations could be implemented. There are most probably better ways to do this, since I have not really any insight into the Okular code base, but this was the only viable way I could identify. A drawback of this is that the implementation is spread over several files, a more clean way might however require a slight restructuring to handle Screen annotations similar to how RichMedia annotations are handled. STEPS TO REPRODUCE 1. Open the attached PDF file containing movies embedded as Screen annotations OBSERVED RESULT None of the movies autoplay. EXPECTED RESULT The movie with autoplay enabled (i.e. actions of the page-opening event defined) does not play. SOFTWARE/OS VERSIONS Windows: n/a macOS: n/a Linux/KDE Plasma: Fedora 40 KDE Plasma Version: 6.1.4 KDE Frameworks Version: 6.5.0 Qt Version: 6.7.2
Created attachment 172668 [details] Patch outlining a possible fix Please note that this is completely untested!
It's also worth to mention that this issue has been identified already in bug 436709 (see bug 436709 comment 0 and bug 436709 comment 2), but the fix there was incomplete.
Thanks for the patch. Can you please submit it as a merge request at https://invent.kde.org/graphics/okular/-/merge_requests ? It makes reviewing it much easier.