Repository navigation
Use the extra's mime type for video sources - #1081
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
The <source> element of the media viewer had its type hardcoded to "video/mp4" in the report template, so the mime_type passed to extras.video() was never used. Browsers that honour the type attribute strictly (e.g. Safari) then refuse to play non-MP4 videos such as WebM. Pass the extra's mime_type through to the media viewer and set it on the <source> element whenever a video is shown. If an extra has no mime type, the type attribute is removed so the browser can detect the format itself instead of keeping a stale value from a previous video. Also document extras.video() in the user guide and extend the video integration test to cover a WebM extra. Fixes pytest-dev#819
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.
The
<source>element of the media viewer had its type hardcoded tovideo/mp4inindex.jinja2, so themime_typepassed toextras.video()was never used. Browsers that honour thetypeattribute strictly (e.g. Safari) then refuse to play non-MP4 videos such as WebM.Changes
mime_typethrough to the media viewer (dom.js) and set it on the<source>element whenever a video is shown (mediaviewer.js).extras.extra(..., FORMAT_VIDEO)), remove thetypeattribute so the browser detects the format itself. This also stops a type from a previous video sticking around when navigating between videos.type="video/mp4"from the template.extras.video(video, mime_type='video/webm', extension='webm')to the extras table in the user guide.Testing
test_extra_videointesting/test_integration.pynow builds the extra withextras.video(...)and also coversvideo/webm. The WebM case fails onmasterand passes with this change.<source>getstype="video/webm", thentype="video/mp4", then notype.npm run lintpasses.Fixes #819