Skip to content

Commit

Permalink
feat(base/media): refactoring/lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinteodor committed Oct 4, 2024
1 parent 942ba81 commit 1e566df
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 49 deletions.
9 changes: 3 additions & 6 deletions react/features/base/media/components/native/FallbackView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { View } from 'react-native';

const FallbackView = () => {

return(
<View style={{ height: 800, width: 400, backgroundColor: 'red' }} />
)
}
const FallbackView = () => (

Check failure on line 3 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Unnecessary parentheses around expression
<View style={{ height: 800, width: 400, backgroundColor: 'red' }} />

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

'React' must be in scope when using JSX

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required before '='

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

A space is required after '='

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Color literal: { backgroundColor: 'red' }

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Inline style: { height: 800, width: 400, backgroundColor: 'red' }

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Object properties must go on a new line

Check failure on line 4 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Object properties must go on a new line
)

Check failure on line 5 in react/features/base/media/components/native/FallbackView.tsx

View workflow job for this annotation

GitHub Actions / Lint

Missing semicolon

export default FallbackView;
82 changes: 39 additions & 43 deletions react/features/base/media/components/native/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IReduxState} from '../../../../app/types';
import { translate } from '../../../i18n/functions';
import Pressable from '../../../react/components/native/Pressable';

import logger from '../../logger';
// import logger from '../../logger';

import VideoTransform from './VideoTransform';
import styles from './styles';
Expand Down Expand Up @@ -101,7 +101,6 @@ class Video extends Component<IProps> {
const { _enableIosPIP, onPress, stream, zoomEnabled } = this.props;

const iosPIPOptions = {
startAutomatically: true,
fallbackView: (<FallbackView />),
preferredSize: {
width: 400,
Expand All @@ -121,52 +120,49 @@ class Video extends Component<IProps> {
// stopIOSPIP(this._ref?.current);
}

if (stream) {
// RTCView
const style = styles.video;
const objectFit
= zoomEnabled
? 'contain'
: 'cover';
const rtcView
= (
<RTCPIPView
iosPIP = { iosPIPOptions }
mirror = { this.props.mirror }
objectFit = { objectFit }
ref = { this._ref }
streamURL = { stream.toURL() }
style = { style }
zOrder = { this.props.zOrder } />
);

// VideoTransform implements "pinch to zoom". As part of "pinch to
// zoom", it implements onPress, of course.
if (zoomEnabled) {
return (
<VideoTransform
enabled = { zoomEnabled }
onPress = { onPress }
streamId = { stream.id }
style = { style }>
{ rtcView }
</VideoTransform>
);
}

// XXX Unfortunately, VideoTransform implements a custom press
// detection which has been observed to be very picky about the
// precision of the press unlike the builtin/default/standard press
// detection which is forgiving to imperceptible movements while
// pressing. It's not acceptable to be so picky, especially when
// "pinch to zoom" is not enabled.
// RTCView
const style = styles.video;
const objectFit
= zoomEnabled
? 'contain'
: 'cover';
const rtcView
= (
<RTCPIPView
iosPIP = { iosPIPOptions }
mirror = { this.props.mirror }
objectFit = { objectFit }
streamURL = { stream && stream.toURL() }

Check warning on line 135 in react/features/base/media/components/native/Video.tsx

View workflow job for this annotation

GitHub Actions / Lint

Prefer using an optional chain expression instead, as it's more concise and easier to read
style = { style }
zOrder = { this.props.zOrder } />
);

// VideoTransform implements "pinch to zoom". As part of "pinch to
// zoom", it implements onPress, of course.
if (zoomEnabled) {
return (
<Pressable onPress = { onPress }>
<VideoTransform
enabled = { zoomEnabled }
onPress = { onPress }
streamId = { stream && stream.id }

Check warning on line 147 in react/features/base/media/components/native/Video.tsx

View workflow job for this annotation

GitHub Actions / Lint

Prefer using an optional chain expression instead, as it's more concise and easier to read
style = { style }>
{ rtcView }
</Pressable>
</VideoTransform>
);
}

// XXX Unfortunately, VideoTransform implements a custom press
// detection which has been observed to be very picky about the
// precision of the press unlike the builtin/default/standard press
// detection which is forgiving to imperceptible movements while
// pressing. It's not acceptable to be so picky, especially when
// "pinch to zoom" is not enabled.
return (
<Pressable onPress = { onPress }>
{ rtcView }
</Pressable>
);

// RTCView has peculiarities which may or may not be platform specific.
// For example, it doesn't accept an empty streamURL. If the execution
// reached here, it means that we explicitly chose to not initialize an
Expand Down

0 comments on commit 1e566df

Please sign in to comment.