Class: Proctoring::VideoStreamingsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Proctoring::VideoStreamingsController
- Defined in:
- app/controllers/proctoring/video_streamings_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /video_streamings.
-
#destroy ⇒ Object
DELETE /video_streamings/1.
- #distribute_channel_to_rooms ⇒ Object
-
#edit ⇒ Object
GET /video_streamings/1/edit.
- #event ⇒ Object
-
#index ⇒ Object
GET /video_streamings.
-
#new ⇒ Object
GET /video_streamings/new.
-
#show ⇒ Object
GET /video_streamings/1.
- #stream_channel ⇒ Object
- #stream_room ⇒ Object
-
#update ⇒ Object
PATCH/PUT /video_streamings/1.
-
#upload_video ⇒ Object
PATCH/PUT /video_streamings/1/upload_video.
- #user_channel ⇒ Object
Methods inherited from ApplicationController
#authenticate_api_token, #authenticate_app_token
Instance Method Details
#create ⇒ Object
POST /video_streamings
26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 26 def create @video_streaming = VideoStreaming.new(video_streaming_params) if @video_streaming.save redirect_to @video_streaming, notice: 'Video streaming was successfully created.' else render :new end end |
#destroy ⇒ Object
DELETE /video_streamings/1
59 60 61 62 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 59 def destroy @video_streaming.stopped! redirect_to video_streamings_url, notice: 'Video streaming was successfully destroyed.' end |
#distribute_channel_to_rooms ⇒ Object
86 87 88 89 90 91 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 86 def distribute_channel_to_rooms @no_of_users_in_channel = proctor_user_params[:no_of_users_in_channel].to_i @event_id = proctor_user_params[:event_id] VideoStreaming.setup_rooms(@event_id, @no_of_users_in_channel) @all_rooms = VideoStreamingRoom.where(event_id: @event_id, total_users: @no_of_users_in_channel).active end |
#edit ⇒ Object
GET /video_streamings/1/edit
22 23 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 22 def edit end |
#event ⇒ Object
64 65 66 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 64 def event @video_streamings = VideoStreaming.by_event(params[:id]) end |
#index ⇒ Object
GET /video_streamings
8 9 10 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 8 def index @video_streamings = VideoStreaming.where(status: :active).limit(15) end |
#new ⇒ Object
GET /video_streamings/new
17 18 19 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 17 def new @video_streaming = VideoStreaming.new end |
#show ⇒ Object
GET /video_streamings/1
13 14 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 13 def show end |
#stream_channel ⇒ Object
75 76 77 78 79 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 75 def stream_channel @media_server_url = Proctoring.media_server_url @video_streaming = VideoStreaming.find_by(channel: params[:id]) @channels = [@video_streaming.channel] end |
#stream_room ⇒ Object
81 82 83 84 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 81 def stream_room @media_server_url = Proctoring.media_server_url @video_streaming_room = VideoStreamingRoom.find_by(room: params[:id]) end |
#update ⇒ Object
PATCH/PUT /video_streamings/1
37 38 39 40 41 42 43 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 37 def update if @video_streaming.update(video_streaming_params) redirect_to @video_streaming, notice: 'Video streaming was successfully updated.' else render :edit end end |
#upload_video ⇒ Object
PATCH/PUT /video_streamings/1/upload_video
46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 46 def upload_video video_streaming = video_streaming_params # return unless session[:user_id] != video_streaming[:user_id] # video_streaming[:videos] = @video_streaming.all_attached_videos_sign_ids + video_streaming[:videos] # p video_streaming if @video_streaming.update(video_streaming_params) render json: {}, status: :ok else render json: {}, status: 422 end end |
#user_channel ⇒ Object
68 69 70 71 72 73 |
# File 'app/controllers/proctoring/video_streamings_controller.rb', line 68 def user_channel user_id = params[:user_id] event_id = params[:event_id] video_streaming = VideoStreaming.open_join_channel(user_id, event_id) render json: { id: video_streaming.id, channel: video_streaming.channel, socketURL: Proctoring.media_server_url } end |