Skip to content

Commit 88478b8

Browse files
author
Dave Newman
committed
Use youtube thumbnails for recorded streams
1 parent c5515b8 commit 88478b8

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/controllers/quickstream_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ def webhook
99
puts params[:broadcast]
1010
broadcast_id = params[:broadcast]['id']
1111
@stream = Stream.joins(:user).find_by!('users.username' => params[:streamer], :recording_id => broadcast_id)
12-
@stream.update!(recording_started_at: Time.parse(params[:broadcast]['snippet']['actual_start_time']))
12+
@stream.update!(
13+
recording_started_at: Time.parse(params[:broadcast]['snippet']['actual_start_time']),
14+
)
1315
end
1416
render nothing: true, status: :ok
1517
end

app/controllers/streams_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ def new
1111
@stream.body = old_stream.body
1212
@stream.tags = old_stream.tags
1313
end
14+
elsif @stream.published? && !@stream.archived?
15+
return redirect_to profile_stream_path(current_user.username)
1416
end
1517
if current_user.stream_key.blank?
1618
current_user.generate_stream_key

app/models/stream.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ def active
4747
end
4848

4949
def preview_image_url
50-
"https://api.quickstream.io/coderwall/streams/#{user.username}.png?size=400x"
50+
if archived?
51+
"https://i.ytimg.com/vi/#{recording_id}/sddefault_live.jpg"
52+
else
53+
"https://api.quickstream.io/coderwall/streams/#{user.username}.png?size=400x"
54+
end
5155
end
5256

5357
def source

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy