enable audio for videos #2499
This commit is contained in:
@@ -77,3 +77,13 @@ $preview_flagged_color: #F00;
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin audio-icon {
|
||||||
|
content: "♪";
|
||||||
|
position: absolute;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
color: white;
|
||||||
|
background-color: rgba(0,0,0,0.5);
|
||||||
|
margin: 2px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|||||||
@@ -26,9 +26,13 @@ article.post-preview {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=zip]:before {
|
&[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before {
|
||||||
@include animated-icon;
|
@include animated-icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[data-has-audio=true]:before {
|
||||||
|
@include audio-icon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#iqdb-similar {
|
#iqdb-similar {
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_no_audio
|
def tag_audio
|
||||||
if is_video? && video.audio_channels.present?
|
if is_video? && video.audio_channels.present?
|
||||||
raise "video must not have audio channels"
|
self.tag_string = "#{tag_string} audio"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ class Upload < ActiveRecord::Base
|
|||||||
calculate_hash(file_path)
|
calculate_hash(file_path)
|
||||||
validate_md5_uniqueness
|
validate_md5_uniqueness
|
||||||
validate_md5_confirmation
|
validate_md5_confirmation
|
||||||
validate_no_audio
|
tag_audio
|
||||||
validate_video_duration
|
validate_video_duration
|
||||||
calculate_file_size(file_path)
|
calculate_file_size(file_path)
|
||||||
if has_dimensions?
|
if has_dimensions?
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class PostPresenter < Presenter
|
|||||||
def self.data_attributes(post)
|
def self.data_attributes(post)
|
||||||
%{
|
%{
|
||||||
data-id="#{post.id}"
|
data-id="#{post.id}"
|
||||||
|
data-has-audio="#{post.has_tag?('audio')}"
|
||||||
data-tags="#{h(post.tag_string)}"
|
data-tags="#{h(post.tag_string)}"
|
||||||
data-pools="#{post.pool_string}"
|
data-pools="#{post.pool_string}"
|
||||||
data-uploader="#{h(post.uploader_name)}"
|
data-uploader="#{h(post.uploader_name)}"
|
||||||
|
|||||||
Reference in New Issue
Block a user