Add audioPlayer 1.0.1.1 for OMP 3.5 - #528
Open
edersotto wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Audiobook Player 1.0.1.1, a generic plugin for OMP 3.5 that turns the audio files of a monograph into an audiobook.
See it running
Editora UEMG — an audiobook with 26 tracks, on a live OMP 3.5 installation. Press play on any track and drag the progress bar: that drag is the
206this plugin exists for. No login needed.Why this one
An audio publication format in OMP is a list of download links. A reader who wants to listen downloads each track, opens it somewhere else, and has no way to resume where they stopped. The gallery lists nothing for audio in OMP.
The plugin adds a play button next to every audio file on the book page and a player bar with seeking inside the track, previous/next track, playback speed, continuous playback and resume from the last position. The original download button is left untouched.
The part that needed care: HTTP Range
Seeking in a media element requires the server to answer
206 Partial Content.PKPFileService::download()sendsAccept-Ranges: noneand ignoresRange(lib/pkp/classes/services/PKPFileService.php:179), so dragging the progress bar re-downloads the file from byte 0 — we opened pkp/pkp-lib#13250 about that separately.So the plugin serves the audio itself, implementing RFC 9110 §14.1: closed, open and suffix ranges,
206with a correctContent-Range, and416withContent-Range: bytes */<size>for an unsatisfiable range.It is not a way around access control
It serves the file from inside the
CatalogBookHandler::downloadhook, which fires after the whole OMP access check has already run —OmpPublishedSubmissionAccessPolicy, the format being available, the publication being published, and the file'sdirect_sales_price. The plugin inherits the check instead of repeating any part of it, and registers no route of its own.That is asserted, not asserted-in-prose: one test pins the exact set of hooks the plugin registers, another proves it registers no routing of its own. Verified on a server as well — the same MP3 requested with
?audioStream=1answers206when the file is open, and404when the file has no direct sales price, when the format is unavailable and when the publication is not published: identical to the ordinary download in all three cases.Packaging
ApplicationPluginssuite: the range computation against RFC 9110 §14.1 (closed, open, single-byte, suffix, suffix larger than the file, end past the file, and five unsatisfiable forms that must become416), audio detection, mimetype resolution when the stored type is generic, access control, and locale integrity.Rangerequest that must answer206and an unsatisfiable one that must answer416.One deployment note
A reverse proxy configured with
proxy_cachestripsRangebefore it reaches PHP, which makes a correct implementation look broken. The README documents the nginx snippet that forwards it for this route.Checks run before opening this
xmllint --schema ./plugins.xsd ./plugins.xml --noout— validates.735e2509397d0a4de995aaed08c4238e).audioPlayer/directory.Notes
Submitted as
reviewed, following what other third-party plugins declare here. Happy to adjust anything in the entry if you would like it different.