use full live stream url
This commit is contained in:
@@ -26,7 +26,7 @@ $(document).on "turbolinks:load", ->
|
|||||||
$("#broadcast_video").html data.video_content
|
$("#broadcast_video").html data.video_content
|
||||||
new (Clappr.Player)(
|
new (Clappr.Player)(
|
||||||
parentId: '#broadcast_video'
|
parentId: '#broadcast_video'
|
||||||
source: data.playback_url
|
source: data.full_live_stream_playback_url
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
mute: true,
|
mute: true,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class BroadcastsChannel < ApplicationCable::Channel
|
|||||||
event: :broadcast_stream_update,
|
event: :broadcast_stream_update,
|
||||||
status: broadcast.status,
|
status: broadcast.status,
|
||||||
playback_url: broadcast.stream_playback_url,
|
playback_url: broadcast.stream_playback_url,
|
||||||
|
full_live_stream_playback_url: broadcast.full_live_stream_playback_url,
|
||||||
video_content: video_content,
|
video_content: video_content,
|
||||||
status_content: status_content,
|
status_content: status_content,
|
||||||
streamer_status: broadcast.streamer_status
|
streamer_status: broadcast.streamer_status
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ class StreamNotificationsController < ApplicationController
|
|||||||
when "video.live_stream.recording"
|
when "video.live_stream.recording"
|
||||||
@broadcast.streamer_recording!
|
@broadcast.streamer_recording!
|
||||||
notify_users
|
notify_users
|
||||||
|
when "video.asset.ready"
|
||||||
|
full_live_stream_playback_uid = notification.dig(:data, :playback_ids, 0, :id)
|
||||||
|
@broadcast.full_live_stream_playback_uid = full_live_stream_playback_uid
|
||||||
|
@broadcast.save
|
||||||
|
notify_users
|
||||||
when "video.live_stream.active"
|
when "video.live_stream.active"
|
||||||
@broadcast.active!
|
@broadcast.active!
|
||||||
notify_users
|
notify_users
|
||||||
@@ -59,7 +64,8 @@ class StreamNotificationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_broadcast
|
def set_broadcast
|
||||||
if notification_type == "video.asset.static_renditions.ready"
|
case notification_type
|
||||||
|
when "video.asset.static_renditions.ready", "video.asset.ready"
|
||||||
live_stream_id = notification.dig(:stream_notification, :data, :live_stream_id)
|
live_stream_id = notification.dig(:stream_notification, :data, :live_stream_id)
|
||||||
@broadcast = Broadcast.find_by(stream_uid: live_stream_id)
|
@broadcast = Broadcast.find_by(stream_uid: live_stream_id)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ class Broadcast < ApplicationRecord
|
|||||||
"https://stream.mux.com/#{stream_playback_uid}.m3u8"
|
"https://stream.mux.com/#{stream_playback_uid}.m3u8"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def full_live_stream_playback_url
|
||||||
|
"https://stream.mux.com/#{full_live_stream_playback_uid}.m3u8"
|
||||||
|
end
|
||||||
|
|
||||||
def stream_server_url
|
def stream_server_url
|
||||||
ENV['MUX_BROADCAST_SERVER_URL']
|
ENV['MUX_BROADCAST_SERVER_URL']
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class AddFullLiveStreamPlaybackUrlToBroadcasts < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
add_column :broadcasts, :full_live_stream_playback_uid, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user