Objective
How to implement Zoom in/out feature in React Native?
Applies To
- Mobile SDK
- Video API
Procedure
This is a simple modification of the basic sample app at the opentok-react-native-samples repo. Github Repo Link
OTSubscriber
style={{
width: 200,
height: 150,
transform: [
{scale: this.state.subscriberScale},
{translateX: 30},
{translateY: 30},
],
}}
ref={instance => {
this.subscriber = instance;
}}
/>
There are also lines of code for the subscriberScale
state property.
class App extends Component {
constructor(props) {
super(props);
// ...
this.state = {
subscriberScale: 1,
};
setInterval(() => {
const newScale = this.state.subscriberScale === 1 ? 0.5 : 1;
this.setState({subscriberScale: newScale});
}, 1000);
// ...
Wrapping the OTSubscriber component in a React Native View component and the animation to that (this is taken from the react-native-gesture-handler quick start)
<GestureDetector>
<Animated.View style={[styles.ball, animatedStyles]} >
<OTSubscriber />
</Animated.View>
</GestureDetector>
Additional Information
React Native Sample app - https://github.com/opentok/opentok-react-native-samples/tree/main/BasicVideoChat
Articles in this section
- Android SDK 2.28.2 error when using the application context
- What happens if your session lasts more than 8 hours?
- Updates to using the Vonage Media Library in Native SDKs from version 2.27.x onwards
- React-Native Zoom In/Out Feature
- Why has the size of the iOS/Android SDKs increased so much from version 2.25.2?
- Integrating Picture-in-Picture with Vonage Video Web
- How to Use the Vonage Media Processor Library for Audio and Video Transformations
- Screen Sharing Support on Mobile Devices
- How to change the strength of the Background Blur?
- What are the minimum system requirements to use Video Filters or Transformers?