mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-04-29 23:29:15 +08:00
When enabled this will convert uploaded videos to a standard format that should be playable on all devices and browsers. The goal of this feature is to prevent codec playback issues that sometimes can occur with video uploads. It uses an adapter pattern, so that other services for video conversion could be easily added in the future.
16 lines
435 B
Ruby
16 lines
435 B
Ruby
# frozen_string_literal: true
|
|
|
|
module VideoConversion
|
|
class AdapterFactory
|
|
def self.get_adapter(upload, options = {})
|
|
adapter_type = options[:adapter_type] || SiteSetting.video_conversion_service
|
|
|
|
case adapter_type
|
|
when "aws_mediaconvert"
|
|
AwsMediaConvertAdapter.new(upload, options)
|
|
else
|
|
raise ArgumentError, "Unknown video conversion service: #{adapter_type}"
|
|
end
|
|
end
|
|
end
|
|
end
|