Skip to content

Commit

Permalink
fix(WebexRemoteMedia): make remote video draggable
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshtezu authored and rarajes2 committed Jul 27, 2023
1 parent 3583b0d commit e67ce56
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 63 deletions.
38 changes: 22 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"adaptivecards-templating": "^2.2.0",
"classnames": "^2.2.6",
"date-fns": "^2.15.0",
"markdown-it": "^12.3.2"
"markdown-it": "^12.3.2",
"react-draggable": "^4.4.5"
},
"devDependencies": {
"@babel/core": "^7.11.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ Array [
<div
className="wxc wxc-remote-media wxc-in-meeting__remote-media-in-meeting wxc-remote-media--remote-video-n-share"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-share"
Expand Down Expand Up @@ -288,12 +292,16 @@ Array [
<div
className="wxc wxc-remote-media wxc-in-meeting__remote-media-in-meeting"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
<audio
autoPlay={true}
/>
Expand Down Expand Up @@ -374,12 +382,16 @@ Array [
<div
className="wxc wxc-remote-media wxc-in-meeting__remote-media-in-meeting wxc-remote-media--remote-video-n-share"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-share"
Expand Down Expand Up @@ -466,12 +478,16 @@ Array [
<div
className="wxc wxc-remote-media wxc-in-meeting__remote-media-in-meeting"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
</div>
<div
className="wxc wxc-local-media wxc-in-meeting__local-media-in-meeting wxc-local-media--no-media"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ Array [
<div
className="wxc wxc-remote-media wxc-in-meeting__remote-media-in-meeting"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
<audio
autoPlay={true}
/>
Expand Down
11 changes: 7 additions & 4 deletions src/components/WebexRemoteMedia/WebexRemoteMedia.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable jsx-a11y/media-has-caption */
import React, {useContext, useEffect} from 'react';
import Draggable from 'react-draggable';
import PropTypes from 'prop-types';
import Badge from '../generic/Badge/Badge';
import Icon from '../generic/Icon/Icon';
Expand Down Expand Up @@ -84,10 +85,12 @@ export default function WebexRemoteMedia({
} else if (hasMedia && hasOtherMembers) {
remoteDisplay = (
<>
{remoteVideo
&& <video className={`${sc('video')} ${sc('remote-video')}`} ref={videoRef} muted playsInline autoPlay />}
{remoteShare
&& <video className={`${sc('video')} ${sc('remote-share')}`} ref={shareRef} muted playsInline autoPlay />}
{remoteVideo && (
<Draggable bounds="parent">
<video className={`${sc('video')} ${sc('remote-video')}`} ref={videoRef} muted playsInline autoPlay />
</Draggable>
)}
{remoteShare && <video className={`${sc('video')} ${sc('remote-share')}`} ref={shareRef} muted playsInline autoPlay />}
{remoteAudio && <audio ref={audioRef} autoPlay />}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ Array [
}
}
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-share"
Expand Down Expand Up @@ -230,12 +234,16 @@ Array [
}
}
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
<Draggable
bounds="parent"
>
<video
autoPlay={true}
className="wxc-remote-media__video wxc-remote-media__remote-video"
muted={true}
playsInline={true}
/>
</Draggable>
</div>,
<video
autoPlay={true}
Expand Down
2 changes: 2 additions & 0 deletions src/storyshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jest.mock('./util', () => ({
uniqueId: () => 'wxc-0',
}));

jest.mock('react-draggable', () => 'Draggable');

/**
* Returns a mock DOM ref object for use of snapshot tests.
*
Expand Down

0 comments on commit e67ce56

Please sign in to comment.