1

I have published a react native application to google play store for android tv.

For tv, I have received notification for:

Play/Pause key event is not respected during playback Your media apps that play video or music content must respect the play/pause key during playback. Please refer to our Media Play/Pause documentation and Update the Playback State documentation for details. For example, your app does not pause the video being played when pressing the pause button on the Android TV controller.

How do I fix this issue for react-native android TV apps?

ViShU
  • 300
  • 2
  • 10

1 Answers1

0

try adding play/pause Event Listeners

  const _tvEventHandler = new TVEventHandler();    
  const [isPaused, setIsPaused] = useState(false);

 
   const _enableTVEventHandler = () => {
_tvEventHandler.enable(this, function (cmp, evt) {
  console.log(evt);
  if (evt && evt.eventType === 'right') {
    console.log(evt.eventType);
  } else if (evt && evt.eventType === 'up') {
    console.log(evt.eventType);
  } else if (evt && evt.eventType === 'left') {
    console.log(evt.eventType);
  } else if (evt && evt.eventType === 'down') {
    console.log(evt.eventType);
  } else if (evt && evt.eventType === 'select') {
    setIsPaused(!isPaused);
  }
});

};

Aniket
  • 982
  • 1
  • 11
  • 16