Abilita l'embed YouTube sulle dirette e tiene la copia locale se il VOD non è incorporabile.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,7 +24,8 @@ module Youtube
|
||||
),
|
||||
content_details: Google::Apis::YoutubeV3::LiveBroadcastContentDetails.new(
|
||||
enable_auto_start: true,
|
||||
enable_auto_stop: false
|
||||
enable_auto_stop: false,
|
||||
enable_embed: true
|
||||
)
|
||||
)
|
||||
result = client.insert_live_broadcast("snippet,status,contentDetails", broadcast)
|
||||
@@ -97,6 +98,24 @@ module Youtube
|
||||
:skipped
|
||||
end
|
||||
|
||||
def enable_video_embed!(video_id, privacy_status: "unlisted")
|
||||
return if video_id.blank? || video_id.to_s.start_with?("mock_")
|
||||
return if @credential.blank? || missing_oauth_config?
|
||||
|
||||
client = authorized_client
|
||||
video = Google::Apis::YoutubeV3::Video.new(
|
||||
id: video_id,
|
||||
status: Google::Apis::YoutubeV3::VideoStatus.new(
|
||||
embeddable: true,
|
||||
privacy_status: privacy_status.presence || "unlisted",
|
||||
self_declared_made_for_kids: false
|
||||
)
|
||||
)
|
||||
client.update_video("status", video)
|
||||
rescue Google::Apis::Error => e
|
||||
raise Error, e.message
|
||||
end
|
||||
|
||||
def complete_broadcast!(broadcast_id)
|
||||
return if broadcast_id.blank?
|
||||
return if @credential.blank? || missing_oauth_config?
|
||||
|
||||
Reference in New Issue
Block a user