Skip to content

Feature for #16654, embedded audio elements in markdown.

What does this MR do?

This MR enables embedded audio in Gitlab markdown, as discussed in #16654 (closed).

Screenshots

Before After
before-audio-md after-audio-md

Details

Given the similarities between video and audio elements, these changes were mostly a copy of everything done for video files as it relates to markdown. I tried to be as boring as possible with these copies, not trying to introduce any special refactoring.

I did add a new section on embedded audio in the markdown docs.

Help Needed

I ran into issues with 2 tests in spec/models/commit_spec and spec/lib/banzai/filter/relative_link_filter_spec.rb. Basically I could not introduce passing versions of the tests for audio files. What's tricky is that the existing tests seem to be handled very differently between image and video files.

The tests for images reference plain paths, while tests for videos reference paths associated with a specific commit. Also, I found that the image filenames are directly referenced in the Gitaly repository, while the videos are not. For the videos, I noticed a special "video" branch and sha in test_env.rb, which was created when these video related tests were added in this commit.

On top of all that, I found that if I changed the file extension for images, or videos, to other valid extensions of the same file type (ie: ".png" to ".jpeg" or ".mp4" to ".mov"), the tests will fail in commit_spec.rb. For these reasons, I'm pretty sure there's some special handling that must be done in these tests that I'm currently unaware of -- I would appreciate any help in completing these tests.

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

I tested this in Chrome and Firefox. These changes make use of the native HTML5 audio element, which is supported by all Gitlab-supported browsers.

Security

I can not think of any security concerns.

Closes #16654 (closed)

Edited by Jesse Hall

Merge request reports

Loading