fix(video-layout): contact list click behaves like thumbnail click

Checks exist when clicking a contact list to prevent the pinning
UI from updating if a remote thumbnail has not loaded video.
This was unexpected UX so instead go ahead and pin. This is
accomplished by having contact list clicks to more directly
trigger the flow of a thumbnail being clicked.
This commit is contained in:
Leonard Kim 2017-11-08 14:55:48 -08:00 committed by yanas
parent e7aff1d8e1
commit 95fcc7702f
1 changed files with 3 additions and 39 deletions

View File

@ -79,7 +79,7 @@ const VideoLayout = {
// the local video thumb maybe one pixel // the local video thumb maybe one pixel
this.resizeThumbnails(false, true); this.resizeThumbnails(false, true);
this._onContactClicked = onContactClicked.bind(this); this.handleVideoThumbClicked = this.handleVideoThumbClicked.bind(this);
this.registerListeners(); this.registerListeners();
}, },
@ -105,7 +105,7 @@ const VideoLayout = {
eventEmitter.addListener(UIEvents.LOCAL_FLIPX_CHANGED, eventEmitter.addListener(UIEvents.LOCAL_FLIPX_CHANGED,
onLocalFlipXChanged); onLocalFlipXChanged);
eventEmitter.addListener(UIEvents.CONTACT_CLICKED, eventEmitter.addListener(UIEvents.CONTACT_CLICKED,
this._onContactClicked); this.handleVideoThumbClicked);
}, },
/** /**
@ -116,7 +116,7 @@ const VideoLayout = {
unregisterListeners() { unregisterListeners() {
if (this._onContactClicked) { if (this._onContactClicked) {
eventEmitter.removeListener(UIEvents.CONTACT_CLICKED, eventEmitter.removeListener(UIEvents.CONTACT_CLICKED,
this._onContactClicked); this.handleVideoThumbClicked);
} }
}, },
@ -1206,40 +1206,4 @@ const VideoLayout = {
} }
}; };
/**
* On contact list item clicked.
*/
function onContactClicked(id) {
if (APP.conference.isLocalId(id)) {
$('#localVideoContainer').click();
return;
}
const remoteVideo = remoteVideos[id];
if (remoteVideo && remoteVideo.hasVideo()) {
// It is not always the case that a videoThumb exists (if there is
// no actual video).
if (remoteVideo.hasVideoStarted()) {
// We have a video src, great! Let's update the large video
// now.
VideoLayout.handleVideoThumbClicked(id);
} 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 lastNPickupId variable to be
// picked up later by the lastN changed event handler.
// eslint-disable-next-line no-invalid-this
this.pinParticipant(remoteVideo.id);
}
}
}
export default VideoLayout; export default VideoLayout;