Expo Video cause big lag on Android

Hi guys,

I’m using the expo video component. It works pretty good on iOS.
However it causes big performance issues in my android device (even with built .apk)

This happens when I try to programmatically change the rate or activate mute mode (by binding to state props).

<Video source={{ uri: this.state.link }}
  rate={this.state.slowmotion ? 0.5 : 1.0}
  onError={console.log}
  onLoad={console.log}
  volume={1.0}
  isMuted={this.state.mute}
  resizeMode={Video.RESIZE_MODE_CONTAIN}
  shouldPlay={this.state.shouldPlay}
  style={{paddingBottom: this.state.componentHeight , backgroundColor: '#000000'}}
  useNativeControls={true}
  onFullscreenUpdate={this.onFullscreenUpdate}
  onReadyForDisplay={this.updateSize}
/>

Does anyone face the same issue ? Any suggest ?

Thanks a lot

MC

Hey @mcanzerini,

Can you provide a Snack that we can check out to try and reproduce this behavior on our end?

Cheers,
Adam

Hello,

First of all, thanks a lot for your answer and sorry for the delay.

Here is a snack

The problem only appears in Android. Clicking on custom controls (mute and rate black icons) causes big lag.

Thanks for your help

MC

Guys, we can close this thread. I resolved my issue by using a combination of those 3 functions :

  • videoRef.getStatusAsync()
  • videoRef.setIsMutedAsync(value)
  • videoRef.setRateAsync(value, shouldCorrectPitch, pitchCorrectionQuality)

Instead of binding rate value and mute value to the state.

Thanks for your support

MC

2 Likes

Nice work! Happy to hear you got thing sorted out.