Conversation
27ec10d to
1804f7b
Compare
Fix #4827 Accept uploads of OGG, WAV, FLAC, OPUS and MP3 files, and converts them to OGG. Media attachments get a new `audio` type. In the UI, audio uploads are displayed identically to video uploads.
1804f7b to
cdb7c5a
Compare
| ); | ||
| } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') { | ||
| } else if (['video', 'audio'].includes(status.getIn(['media_attachments', 0, 'type']))) { | ||
| const video = status.getIn(['media_attachments', 0]); |
There was a problem hiding this comment.
mb rename video to something more generic?
|
|
||
| - if !status.media_attachments.empty? | ||
| - if status.media_attachments.first.video? | ||
| - if status.media_attachments.first.video? || status.media_attachments.first.audio? |
There was a problem hiding this comment.
let's put this into a method on MediaAttachment, like use_video_player?
|
|
||
| - if !status.media_attachments.empty? | ||
| - if status.media_attachments.first.video? | ||
| - if status.media_attachments.first.video? || status.media_attachments.first.audio? |
| @media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i)) | ||
|
|
||
| raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:video?) | ||
| raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find { |x| x.video? || x.audio? } |
There was a problem hiding this comment.
this should be larger_media_format? right?
| @body_classes = 'player' | ||
| response.headers['X-Frame-Options'] = 'ALLOWALL' | ||
| raise ActiveRecord::RecordNotFound unless @media_attachment.video? || @media_attachment.gifv? | ||
| raise ActiveRecord::RecordNotFound unless @media_attachment.video? || @media_attachment.gifv? || @media_attachment.audio? |
There was a problem hiding this comment.
can/should this also be larger_media_format?
|
Sick! 🎉 |
|
Is there any way we can simply embed the file as-is, without transcoding lossy source files to another format? |
|
No, it won't be playable on all platforms then |
|
Perhaps an option could be included in a users settings that allows them to override this default setting, with a warning given to the tune of your reply. if I upload a 96kbps opus file and it gets transcoded to 192kbps mp3 it's going to sound like a 96kbps mp3 regardless of the extra file size edit: i know remarkably little about actual software engineering so if this isn't tenable please let me know, i can be tooted at @tn5421@niu.moe |
|
We use variable bitrate so I don't think the file will be bigger if the source isn't higher quality |
|
Suggestion: Make the audio player smaller like in the previous PR |
|
@tn5421 96kbps opus and 96kbps mp3 are not the same at all -- the 96kbps opus will sound vastly better since the opus codec is more efficient than mp3. also as stated, with variable bitrate the bitrate of a section of audio is allowed to dip down. there is still a quality loss with lossy->lossy transcode, but not so much that it makes the audio unusable. what could be done is, if you are uploading an mp3 and it is already below a certain size or bitrate, then the transcode is skipped. |
Nothing needs to be done. That's how it is |
* Add audio uploads Fix mastodon#4827 Accept uploads of OGG, WAV, FLAC, OPUS and MP3 files, and converts them to OGG. Media attachments get a new `audio` type. In the UI, audio uploads are displayed identically to video uploads. * Improve code style
* Add audio uploads Fix mastodon#4827 Accept uploads of OGG, WAV, FLAC, OPUS and MP3 files, and converts them to OGG. Media attachments get a new `audio` type. In the UI, audio uploads are displayed identically to video uploads. * Improve code style
Fix #4827
Accept uploads of OGG, WAV, FLAC, OPUS and MP3 files, and converts them to OGG. Media attachments get a new
audiotype. In the UI, audio uploads are displayed identically to video uploads.This is a second take on #9480 because the audio player design was giving me grief and it was ambigous whether or not we need to parse, save, and edit special information about the files, like title, artist, album, etc. An audio player looks barren without those things, but they introduce more complexity, require a system-level dependency (
libtag1-dev), require deciding on subset of tags to duplicate into our own schema, and require a way to store cover art within the media attachment model.