Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I love this mod and would find it useful if it could work with other formats as well as image for the file field. Would it be possible to make video & audio files work also?
I think users would find this very useful
Thanks for all your hardwork :)
Comment | File | Size | Author |
---|---|---|---|
#16 | insert-1431322-audio_and_video_tag-2.patch | 11.08 KB | Snater |
#13 | insert-1431322-audio_and_video_tag.patch | 7.05 KB | Snater |
#11 | insert-audio-video-1431322-11.patch | 6.44 KB | mcruzvcn |
Comments
Comment #1
hefox CreditAttribution: hefox commentedThis is actually rather simple patch, as far as I can tell, if one is assuming what someone wants to embed is an HTML 5 tag (else theirs some sort of outside depedency on x y z video player). e.g. for audio files, it could insert an audio tag, and video files could do video.
I believe there's some js scripts out there to change video tags to hosted video player in older browsers, may be the same for audio.
Comment #2
hefox CreditAttribution: hefox commentedHere's a patch that adds the audio tag
Note that filtered HTML doesn't allow audio tag by default :/
Note: it's missing other file formats, need to look up which ones are (commonly?) supported by audio tag.
Comment #3
quicksketchHm interesting. This seems like a good start, but I'm not sure if
<audio>
is widely supported enough yet to make it the only approach for an inline insertion. Same problem with<video>
.Comment #4
quicksketchFor example, it looks like Firefox (still) doesn't support MP3 audio tags: http://stackoverflow.com/questions/4923136/why-doesnt-firefox-support-mp...
Comment #5
hefox CreditAttribution: hefox commentedPerhaps auto should have settings on what tags it applies per field? That way those that want it to automatically do audio for audio can, but others don't.
Comment #6
arrubiu CreditAttribution: arrubiu commentedIt could be useful also a simple "insert" button that adds a link to the file
Comment #7
quicksketchInsert module already provides an option to insert as a link to the file.
Comment #8
arrubiu CreditAttribution: arrubiu commentedYes, but, as I remember, it doesn't work if I have a file with "Media selector" widget.
Comment #9
drupal a11y CreditAttribution: drupal a11y commentedA solution for this is this module which also supports images: https://drupal.org/project/insert_video
The disadvantage is that it is a little buggy (insert button appears after saving node or pressing "add another item") and that the insert-presets are based on "view-modes".
Comment #10
grahlI needed video support for this and adapted hefox's solution to do so. It only supports mp4 and no configuration, though that could of course be added.
Comment #11
mcruzvcn CreditAttribution: mcruzvcn commentedBoth patches are wrong implemented.
I have tried to apply them and they failed.
I removed both files and build a new patch using your code.
Comment #12
hacioglu CreditAttribution: hacioglu commentedHi,
I applied the patch in 11, but can still not upload files beside png, gif, jpg and jpeg. In the field settings I added mp4, but it didn't work.
What am I missing?
Comment #13
Snater CreditAttribution: Snater commentedI am browsing through old issues while working on the module's D8 version. There is also an issue regarding the D8 version: #2987311: Allow embedding audio/video
Audio and video tag seem to be pretty common by now. Yet, arguments that I mentioned in the D8 ticket, apply here as well.
Apart from that, It does not seem to be hard to implement and I attached a change set that should support embedding audio and video on generic file fields. This functionality could also be implemented in separate/custom module instead of directly in Insert by using hooks.
I will leave the change set here for a while and then decide on it. Please feel free to test and comment.
Comment #14
DrupalGideonI had a cursory glance and noticed you're using short array syntax in this patch #13, which sadly shouldn't be used on D7.
https://www.drupal.org/docs/develop/standards/coding-standards#array
Comment #15
Snater CreditAttribution: Snater commentedI guess I have been in D8 mode. ;) I will touch the code again before merging anyway, because it's probably not a good idea to figure out auto-detection by the mime type, as not all images and videos are rendered by all browsers. Maybe this should be a config option, as it would be a solution to #2918451: Add Support for inserting SVGs as images. as well.
Comment #16
Snater CreditAttribution: Snater commentedThe updated change adds a global configuration page to configure audio and video file type detection.
Comment #18
Snater CreditAttribution: Snater commentedApart from some slight improvements, the committed change does not set default file extensions that should be detected as audio/video files, as the change in behaviour of the "Automatic" Insert style would require tagging a new major version of the module.