question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native player controls ignoring 'playing' prop

See original GitHub issue

I want to use the native controls, but also pause the player with the playing prop. I have a few timestamps within my video and i want to jump to them and pause the player.

const playerRef = useRef<ReactPlayer>()
const [playing, setPlaying] = useState(false)

useEffect(() => {
  setPlaying(false)
  playerRef.current.seekTo(playhead, 'seconds')
},        [playhead]) // playhead is set on click on a timestamp

<ReactPlayer
  ref={playerRef}
  playing={playing}
  url={url}
  controls={true}
  />

Current Behavior

if the player is started from the native controls, it ignores the playing prop.

if i control the player only with the playing prop, everything is working

Expected Behavior

regardless of the type of controls i use, the video should play and pause according the playing prop.

Environment

  • Browser: Version 78.0.3904.87
  • Operating system: Fedora 31

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cdreiercommented, Nov 8, 2019

as i think the additional callbacks are more a workaround, read a bit through the code

in https://github.com/CookPete/react-player/blob/master/src/Player.js#L55 are checks for the prevProps.playing and if it toggled - but the native controls, does not change the props. Can we just remove the prevProps.playing checks?

if the new props want the player to pause, why not just pause?

0reactions
cdreiercommented, Nov 15, 2019

Alright, so thanks a lot for the discussion 😃

As we have a solution and will not change anything, I close this issue.

Best regards, Christian

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native player controls ignoring 'playing' prop #737 - GitHub
Native player controls ignoring 'playing' prop #737 ... I want to use the native controls, but also pause the player with the playing...
Read more >
React-Native-Video controls working in iOS but not android ...
This component works perfectly in iOS, but it doesn't work on Android. The controls don't update when pressed (play doesn't turn into pause)...
Read more >
react-native-video - npm
Set the ignoreSilentSwitch prop to "ignore". Platforms: Android ExoPlayer, Android MediaPlayer, iOS. playWhenInactive. Determine whether the ...
Read more >
Video.js Options Reference
When this option is false (the default), responsive breakpoints will be ignored. Note this is about the responsiveness of the controls within the...
Read more >
YouTube Player API Reference for iframe Embeds
The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Using the API's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found