|
|
|
|
@ -456,6 +456,11 @@ var VideoLayout = (function (my) { |
|
|
|
|
return containerElement.id.substring(i + 12);
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
my.getPeerVideoSel = function (peerResourceJid) { |
|
|
|
|
return $('#participant_' + peerResourceJid + |
|
|
|
|
'>' + APP.RTC.getVideoElementName()); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* On contact list item clicked. |
|
|
|
|
*/ |
|
|
|
|
@ -464,40 +469,40 @@ var VideoLayout = (function (my) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (jid == APP.xmpp.myJid()) { |
|
|
|
|
$("#localVideoContainer").click(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var resource = Strophe.getResourceFromJid(jid); |
|
|
|
|
var videoContainer = $("#participant_" + resource); |
|
|
|
|
if (videoContainer.length > 0) { |
|
|
|
|
var videoThumb |
|
|
|
|
= $(RTC.getVideoElementName(), videoContainer).get(0); |
|
|
|
|
var videoSel = VideoLayout.getVideoSelector(resource); |
|
|
|
|
if (videoSel.length > 0) { |
|
|
|
|
var videoThumb = videoSel[0]; |
|
|
|
|
// It is not always the case that a videoThumb exists (if there is
|
|
|
|
|
// no actual video).
|
|
|
|
|
if (videoThumb) { |
|
|
|
|
if (videoThumb.src && videoThumb.src != '') { |
|
|
|
|
|
|
|
|
|
// We have a video src, great! Let's update the large video
|
|
|
|
|
// now.
|
|
|
|
|
|
|
|
|
|
VideoLayout.handleVideoThumbClicked( |
|
|
|
|
false, |
|
|
|
|
Strophe.getResourceFromJid(jid)); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
// If we don't have a video src for jid, there's absolutely
|
|
|
|
|
// no point in calling handleVideoThumbClicked; Quite
|
|
|
|
|
// simply, it won't work because it needs an src to attach
|
|
|
|
|
// to the large video.
|
|
|
|
|
//
|
|
|
|
|
// Instead, we trigger the pinned endpoint changed event to
|
|
|
|
|
// let the bridge adjust its lastN set for myjid and store
|
|
|
|
|
// the pinned user in the lastNPickupJid variable to be
|
|
|
|
|
// picked up later by the lastN changed event handler.
|
|
|
|
|
|
|
|
|
|
lastNPickupJid = jid; |
|
|
|
|
eventEmitter.emit(UIEvents.PINNED_ENDPOINT, |
|
|
|
|
Strophe.getResourceFromJid(jid)); |
|
|
|
|
} |
|
|
|
|
} else if (jid == APP.xmpp.myJid()) { |
|
|
|
|
$("#localVideoContainer").click(); |
|
|
|
|
// FIXME: checking on .src will not work with Temasys plugin
|
|
|
|
|
if (videoThumb.src && videoThumb.src !== '') { |
|
|
|
|
|
|
|
|
|
// We have a video src, great! Let's update the large video
|
|
|
|
|
// now.
|
|
|
|
|
VideoLayout.handleVideoThumbClicked( |
|
|
|
|
false, |
|
|
|
|
Strophe.getResourceFromJid(jid)); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
// If we don't have a video src for jid, there's absolutely
|
|
|
|
|
// no point in calling handleVideoThumbClicked; Quite
|
|
|
|
|
// simply, it won't work because it needs an src to attach
|
|
|
|
|
// to the large video.
|
|
|
|
|
//
|
|
|
|
|
// Instead, we trigger the pinned endpoint changed event to
|
|
|
|
|
// let the bridge adjust its lastN set for myjid and store
|
|
|
|
|
// the pinned user in the lastNPickupJid variable to be
|
|
|
|
|
// picked up later by the lastN changed event handler.
|
|
|
|
|
|
|
|
|
|
lastNPickupJid = jid; |
|
|
|
|
eventEmitter.emit(UIEvents.PINNED_ENDPOINT, |
|
|
|
|
Strophe.getResourceFromJid(jid)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -530,11 +535,12 @@ var VideoLayout = (function (my) { |
|
|
|
|
if (jid === APP.xmpp.myJid()) { |
|
|
|
|
localVideoThumbnail.showVideoIndicator(value); |
|
|
|
|
} else { |
|
|
|
|
var resource = Strophe.getResourceFromJid(jid); |
|
|
|
|
|
|
|
|
|
VideoLayout.ensurePeerContainerExists(jid); |
|
|
|
|
remoteVideos[Strophe.getResourceFromJid(jid)].showVideoIndicator(value); |
|
|
|
|
remoteVideos[resource].showVideoIndicator(value); |
|
|
|
|
|
|
|
|
|
var el = $('#participant_' + Strophe.getResourceFromJid(jid) |
|
|
|
|
+ '>' + APP.RTC.getVideoElementName()); |
|
|
|
|
var el = VideoLayout.getPeerVideoSel(resource); |
|
|
|
|
if (!value) |
|
|
|
|
el.show(); |
|
|
|
|
else |
|
|
|
|
@ -587,19 +593,15 @@ var VideoLayout = (function (my) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Obtain container for new dominant speaker.
|
|
|
|
|
var container = document.getElementById( |
|
|
|
|
'participant_' + resourceJid); |
|
|
|
|
var videoSel = VideoLayout.getPeerVideoSel(resourceJid); |
|
|
|
|
|
|
|
|
|
// Local video will not have container found, but that's ok
|
|
|
|
|
// since we don't want to switch to local video.
|
|
|
|
|
if (container && !focusedVideoResourceJid) |
|
|
|
|
if (!focusedVideoResourceJid && videoSel.length) |
|
|
|
|
{ |
|
|
|
|
var video |
|
|
|
|
= container.getElementsByTagName(RTC.getVideoElementName()); |
|
|
|
|
|
|
|
|
|
// Update the large video if the video source is already available,
|
|
|
|
|
// otherwise wait for the "videoactive.jingle" event.
|
|
|
|
|
if (video.length && video[0].currentTime > 0) { |
|
|
|
|
if (videoSel[0].currentTime > 0) { |
|
|
|
|
LargeVideo.updateLargeVideo(resourceJid); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -697,8 +699,7 @@ var VideoLayout = (function (my) { |
|
|
|
|
|
|
|
|
|
var jid = APP.xmpp.findJidFromResource(resourceJid); |
|
|
|
|
var mediaStream = APP.RTC.remoteStreams[jid][MediaStreamType.VIDEO_TYPE]; |
|
|
|
|
var sel = $('#participant_' + resourceJid + |
|
|
|
|
'>' + RTC.getVideoElementName()); |
|
|
|
|
var sel = VideoLayout.getPeerVideoSel(resourceJid); |
|
|
|
|
|
|
|
|
|
APP.RTC.attachMediaStream(sel, mediaStream.stream); |
|
|
|
|
if (lastNPickupJid == mediaStream.peerjid) { |
|
|
|
|
|