Fix videocall react cable

This commit is contained in:
Jesse C. Fisher 2023-09-18 15:37:33 +00:00
parent 032d2adbd4
commit 6887ea8bb8
4 changed files with 6 additions and 5 deletions

View File

@ -19,6 +19,7 @@
// require components // require components
//= require qrcode.min.js //= require qrcode.min.js
//= require eyecandy //= require eyecandy
//= require cable
//= require bundle //= require bundle
// require react-rails-hot-loader // require react-rails-hot-loader
// require_tree . // require_tree .

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,8 @@
//= require_tree ./channels //= require_tree ./channels
(function() { (function() {
this.VideoCall || (this.VideoCall = {}); this.App || (this.App = {});
VideoCall.cable = ActionCable.createConsumer(); App.cable = ActionCable.createConsumer();
}).call(this); }).call(this);

View File

@ -22,7 +22,7 @@ class VideoCall extends React.Component{
joinCall(e){ joinCall(e){
console.log("Hello from joinCall"); console.log("Hello from joinCall");
console.log(e); console.log(e);
VideoCall.cable.subscriptions.create( App.cable.subscriptions.create(
{ channel: "CallChannel" }, { channel: "CallChannel" },
{ {
connected: () => { connected: () => {
@ -130,7 +130,7 @@ class VideoCall extends React.Component{
.forEach(function (track) { track.stop(); }) .forEach(function (track) { track.stop(); })
this.localVideo.srcObject = null; this.localVideo.srcObject = null;
VideoCall.cable.subscriptions.subscriptions = []; App.cable.subscriptions.subscriptions = [];
this.remoteVideoContainer.innerHTML = ""; this.remoteVideoContainer.innerHTML = "";
broadcastData({ type: LEAVE_CALL, from: this.userId }); broadcastData({ type: LEAVE_CALL, from: this.userId });
} }