|
@@ -42,12 +42,12 @@
|
|
</div>
|
|
</div>
|
|
@endif
|
|
@endif
|
|
<div class="main-view mx-auto" <?= !$guest ? 'v-show="!!client"' : '' ?>>
|
|
<div class="main-view mx-auto" <?= !$guest ? 'v-show="!!client"' : '' ?>>
|
|
- <div id="self-view" class="full-view"></div>
|
|
|
|
|
|
+ <div id="self-view" class="full-view" data-type="{{ $guest ? 'CLIENT' : 'PRO' }}"></div>
|
|
<div class="thumbs">
|
|
<div class="thumbs">
|
|
<div id="remote-view-1" class="remote-view disconnected-view"
|
|
<div id="remote-view-1" class="remote-view disconnected-view"
|
|
- data-stream="" data-from=""></div>
|
|
|
|
|
|
+ data-stream="" data-from="" data-type=""></div>
|
|
<div id="remote-view-2" class="remote-view disconnected-view"
|
|
<div id="remote-view-2" class="remote-view disconnected-view"
|
|
- data-stream="" data-from=""></div>
|
|
|
|
|
|
+ data-stream="" data-from="" data-type=""></div>
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-danger rounded-circle hang-up"
|
|
<button class="btn btn-danger rounded-circle hang-up"
|
|
v-if="started"
|
|
v-if="started"
|
|
@@ -99,6 +99,7 @@
|
|
patientInQueue: false,
|
|
patientInQueue: false,
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ @if(!$guest)
|
|
pollForNextPatient: function() {
|
|
pollForNextPatient: function() {
|
|
if(!this.started) {
|
|
if(!this.started) {
|
|
this.nextPatient(true);
|
|
this.nextPatient(true);
|
|
@@ -124,7 +125,7 @@
|
|
self.client = true;
|
|
self.client = true;
|
|
self.clientUid = _data.data;
|
|
self.clientUid = _data.data;
|
|
self.getOpenTokSessionId(function() {
|
|
self.getOpenTokSessionId(function() {
|
|
- self.selfName = 'Pro'; // TODO: replace with name of authed pro
|
|
|
|
|
|
+ self.selfName = '{{ $pro->name_display }}';
|
|
$.post('/api/openTok/getClientToken', {
|
|
$.post('/api/openTok/getClientToken', {
|
|
opentokSessionId: self.otSessionId,
|
|
opentokSessionId: self.otSessionId,
|
|
name: self.selfName
|
|
name: self.selfName
|
|
@@ -137,6 +138,7 @@
|
|
}
|
|
}
|
|
}, 'json');
|
|
}, 'json');
|
|
},
|
|
},
|
|
|
|
+ @endif
|
|
getInitials: function(_name) {
|
|
getInitials: function(_name) {
|
|
var parts = _name.split(/\s+/g);
|
|
var parts = _name.split(/\s+/g);
|
|
parts = parts.map(_part => _part[0]);
|
|
parts = parts.map(_part => _part[0]);
|
|
@@ -162,6 +164,7 @@
|
|
@endif
|
|
@endif
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ @if(!$guest)
|
|
callMCPPro: function() {
|
|
callMCPPro: function() {
|
|
|
|
|
|
// put client in mcp queue
|
|
// put client in mcp queue
|
|
@@ -201,7 +204,7 @@
|
|
});
|
|
});
|
|
|
|
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ @endif
|
|
// OT methods
|
|
// OT methods
|
|
initOpenTok: function() {
|
|
initOpenTok: function() {
|
|
|
|
|
|
@@ -252,8 +255,17 @@
|
|
|
|
|
|
self.otSession.subscribe(event.stream, remoteViewElem, subscriberOptions, self.handleOpenTokError);
|
|
self.otSession.subscribe(event.stream, remoteViewElem, subscriberOptions, self.handleOpenTokError);
|
|
|
|
|
|
- $('#' + remoteViewElem).attr('data-stream', event.stream.id);
|
|
|
|
- $('#' + remoteViewElem).attr('data-from', event.stream.connection.data);
|
|
|
|
|
|
+ remoteViewElem = $('#' + remoteViewElem);
|
|
|
|
+ remoteViewElem.attr('data-stream', event.stream.id);
|
|
|
|
+ remoteViewElem.attr('data-from', event.stream.connection.data.split('|')[0]);
|
|
|
|
+
|
|
|
|
+ var userType = event.target.connection.data.split('|')[1];
|
|
|
|
+ if(userType === 'CLIENT') {
|
|
|
|
+ remoteViewElem.attr('data-type', 'CLIENT');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ remoteViewElem.attr('data-type', 'PRO');
|
|
|
|
+ }
|
|
|
|
|
|
@if($guest)
|
|
@if($guest)
|
|
self.pro = true;
|
|
self.pro = true;
|
|
@@ -262,16 +274,6 @@
|
|
self.client = true;
|
|
self.client = true;
|
|
@endif
|
|
@endif
|
|
|
|
|
|
- $('.full-view:not(.disconnected-view)')
|
|
|
|
- .removeClass('full-view')
|
|
|
|
- .addClass('thumb-view')
|
|
|
|
- .prependTo('.thumbs');
|
|
|
|
- $('#' + remoteViewElem)
|
|
|
|
- .removeClass('thumb-view')
|
|
|
|
- .removeClass('disconnected-view')
|
|
|
|
- .addClass('full-view')
|
|
|
|
- .prependTo('.main-view');
|
|
|
|
-
|
|
|
|
if(!self.startTime) {
|
|
if(!self.startTime) {
|
|
self.startTime = new Date().getTime();
|
|
self.startTime = new Date().getTime();
|
|
window.setInterval(function() {
|
|
window.setInterval(function() {
|
|
@@ -279,41 +281,29 @@
|
|
}, 1000);
|
|
}, 1000);
|
|
self.started = true;
|
|
self.started = true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ self.activateParty(event.stream.id);
|
|
});
|
|
});
|
|
|
|
|
|
// peer disconnected
|
|
// peer disconnected
|
|
self.otSession.on("streamDestroyed", function(event) {
|
|
self.otSession.on("streamDestroyed", function(event) {
|
|
- @if($guest)
|
|
|
|
|
|
+
|
|
|
|
+ self.activateParty('self');
|
|
|
|
+
|
|
var remoteViewElem = $('[data-stream="' + event.stream.id + '"]');
|
|
var remoteViewElem = $('[data-stream="' + event.stream.id + '"]');
|
|
if(remoteViewElem.length) {
|
|
if(remoteViewElem.length) {
|
|
- remoteViewElem
|
|
|
|
- .removeClass('full-view')
|
|
|
|
- .removeClass('thumb-view')
|
|
|
|
- .addClass('disconnected-view')
|
|
|
|
- .prependTo('.thumbs');
|
|
|
|
remoteViewElem.attr('data-stream', '');
|
|
remoteViewElem.attr('data-stream', '');
|
|
remoteViewElem.attr('data-from', '');
|
|
remoteViewElem.attr('data-from', '');
|
|
}
|
|
}
|
|
- $('#self-view')
|
|
|
|
- .removeClass('thumb-view')
|
|
|
|
- .removeClass('disconnected-view')
|
|
|
|
- .addClass('full-view')
|
|
|
|
- .prependTo('.main-view');
|
|
|
|
|
|
+
|
|
|
|
+ @if($guest)
|
|
self.pro = false;
|
|
self.pro = false;
|
|
@else
|
|
@else
|
|
- $('#self-view')
|
|
|
|
- .removeClass('thumb-view')
|
|
|
|
- .removeClass('disconnected-view')
|
|
|
|
- .removeClass('full-view')
|
|
|
|
- .prependTo('.thumbs');
|
|
|
|
self.client = false;
|
|
self.client = false;
|
|
@endif
|
|
@endif
|
|
|
|
|
|
- self.started = false;
|
|
|
|
- self.startTime = false;
|
|
|
|
-
|
|
|
|
// if no other parties in call, hang up
|
|
// if no other parties in call, hang up
|
|
- if(!$(':not([data-stream=""])').length) {
|
|
|
|
|
|
+ if(!$('[data-stream]:not([data-stream=""])').length) {
|
|
self.hangUp();
|
|
self.hangUp();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -340,6 +330,17 @@
|
|
};
|
|
};
|
|
var publisher = OT.initPublisher('self-view', publisherOptions, self.handleOpenTokError);
|
|
var publisher = OT.initPublisher('self-view', publisherOptions, self.handleOpenTokError);
|
|
|
|
|
|
|
|
+ publisher.on('streamCreated', function(event) {
|
|
|
|
+ var selfView = $('#self-view');
|
|
|
|
+ selfView.attr('data-stream', event.stream.id);
|
|
|
|
+ selfView.attr('data-from', event.stream.connection.data.split('|')[0]);
|
|
|
|
+ @if($guest)
|
|
|
|
+ selfView.attr('data-type', 'CLIENT');
|
|
|
|
+ @else
|
|
|
|
+ selfView.attr('data-type', 'PRO');
|
|
|
|
+ @endif
|
|
|
|
+ });
|
|
|
|
+
|
|
// Connect to the session
|
|
// Connect to the session
|
|
self.otSession.connect(token, function callback(error) {
|
|
self.otSession.connect(token, function callback(error) {
|
|
if (error) {
|
|
if (error) {
|
|
@@ -396,6 +397,8 @@
|
|
}, 'json');
|
|
}, 'json');
|
|
@endif
|
|
@endif
|
|
},
|
|
},
|
|
|
|
+
|
|
|
|
+ @if(!$guest)
|
|
joinMeetingAsPro: function() {
|
|
joinMeetingAsPro: function() {
|
|
var self = this;
|
|
var self = this;
|
|
$.ajax({
|
|
$.ajax({
|
|
@@ -414,7 +417,35 @@
|
|
console.warn(_data);
|
|
console.warn(_data);
|
|
alert(_data.message);
|
|
alert(_data.message);
|
|
});
|
|
});
|
|
|
|
+ },
|
|
|
|
+ @endif
|
|
|
|
+
|
|
|
|
+ activateParty: function(_stream = 'self') {
|
|
|
|
+ var current = $('.full-view');
|
|
|
|
+ if(current.attr('data-stream') === _stream) return;
|
|
|
|
+ current.removeClass('full-view').addClass('thumb-view');
|
|
|
|
+ if(current.attr('data-type') === 'CLIENT') {
|
|
|
|
+ current.prependTo('.thumbs');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ current.appendTo('.thumbs');
|
|
|
|
+ }
|
|
|
|
+ if(_stream === 'self') {
|
|
|
|
+ $('#self-view')
|
|
|
|
+ .removeClass('thumb-view')
|
|
|
|
+ .removeClass('disconnected-view')
|
|
|
|
+ .addClass('full-view')
|
|
|
|
+ .prependTo('.main-view');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $('div[data-stream="' + _stream + '"]')
|
|
|
|
+ .removeClass('thumb-view')
|
|
|
|
+ .removeClass('disconnected-view')
|
|
|
|
+ .addClass('full-view')
|
|
|
|
+ .prependTo('.main-view');
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
|
|
|
|
@@ -453,19 +484,12 @@
|
|
|
|
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ @else
|
|
|
|
+ localStorage.sessionKey = '{{ $session->session_key }}';
|
|
@endif
|
|
@endif
|
|
|
|
|
|
- $(document).on('click', '.thumbs>div', function() {
|
|
|
|
- $('.full-view')
|
|
|
|
- .removeClass('full-view')
|
|
|
|
- .removeClass('disconnected-view')
|
|
|
|
- .addClass('thumb-view')
|
|
|
|
- .prependTo('.thumbs');
|
|
|
|
- $(this)
|
|
|
|
- .removeClass('thumb-view')
|
|
|
|
- .removeClass('disconnected-view')
|
|
|
|
- .addClass('full-view')
|
|
|
|
- .prependTo('.main-view');
|
|
|
|
|
|
+ $(document).on('click', '.thumbs>div[data-stream]', function() {
|
|
|
|
+ self.activateParty($(this).attr('data-stream'));
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
|
|
|