Project

General

Profile

Actions

Patch #22112

closed

add html5 audio controls if attachment is mp3

Patch #22112: add html5 audio controls if attachment is mp3

Added by nicola mondinelli over 10 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-

Description

I added a simple line on bottom of application.js to create a HTML5 control if the attachment is an mp3.

i share it with you.

$(document).ready(function(){
  $(".attachments p:has(a[href$='.mp3'])").after(function () {
    return "<audio controls><source src=\"" +
      $(this).find(" a[href$='.mp3'] ").attr("href")+"\" type=\"audio/mpeg\"</audio>" 
  });
});

Files


Related issues 2 (0 open — 2 closed)

Related to Redmine - Feature #10138: Video PlayerClosedActions
Related to Redmine - Patch #27336: Render previews for audio and video filesClosedGo MAEDAActions

Updated by Toshi MARUYAMA over 10 years ago Actions #1

  • Description updated (diff)

Updated by Toshi MARUYAMA over 10 years ago Actions #2

  • Description updated (diff)

Updated by diamond2nv GitHub almost 10 years ago Actions #3

Thank for Toshi MARUYAMA having added a simple line on bottom of application.js to create a HTML5 control if the attachment is an mp3.

Add little change for both <video>(.mp4) and <audio>(.mp3) support, just refresh your browser and see after the new js!

 
$(document).ready(function(){
  $(".attachments p:has(a[href$='.mp3'])").after(function () {
    return "<audio controls><source src=\"" +
      $(this).find(" a[href$='.mp3'] ").attr("href")+"\" type=\"audio/mp3\"</audio>" 
  });
});

$(document).ready(function(){
  $(".attachments p:has(a[href$='.mp4'])").after(function () {
    return "<video width=\"600\" height=\"400\" controls><source src=\"" +
      $(this).find(" a[href$='.mp4'] ").attr("href")+"\" type=\"video/mp4\"</video>" 
  });
});

Updated by diamond2nv GitHub almost 10 years ago Actions #4

return "<video width=\"600\" height=\"400\" controls><source src=\"" +

640*360?

Not fit for android browser

Updated by Toshi MARUYAMA over 9 years ago Actions #5

Updated by Go MAEDA almost 9 years ago Actions #6

  • Related to Patch #27336: Render previews for audio and video files added

Updated by Go MAEDA about 8 years ago Actions #7

  • Status changed from New to Closed

The upcoming Redmine 4.0 will have audio/video control on the preview page. Please refer to #27336 for details.

Actions

Also available in: PDF Atom