Code Monkey home page Code Monkey logo

Comments (10)

LonelyCpp avatar LonelyCpp commented on May 20, 2024

Hi @bpark93 Sorry for the slow response.

I tried it with this env, and am not able to reproduce it :(

"expo": "~37.0.3",
"react-native-webview": "8.1.1",
"react-native-youtube-iframe": "^1.2.4"

I also tried it on ios.

ezgif com-video-to-gif (2)

Are you using the player on a modal or any sort of overlay component?
There is a known bug in react-native-webview right now, where fullscreen mode from a modal is buggy (for android only, iOS works good) link to issue

Can you try just a plain webview like and see what happens on fullscreen? The results should be identical for sanity's sake

<WebView 
  mediaPlaybackRequiresUserAction={true} 
  style={{ height: 240, width: 320, alignSelf: "center", alignContent: "center", }} 
  source={{ uri: `https://www.youtube.com/embed/${props.videoKey}?rel=0` }}
/>

from react-native-youtube-iframe.

LonelyCpp avatar LonelyCpp commented on May 20, 2024

Here's another issue that might help you can you try the orientation fix that is mentioned?

from react-native-youtube-iframe.

Foukz avatar Foukz commented on May 20, 2024

I have a similar issue. After switching fullscreen on and off the icons size remains the same as it was when fullscreen was on. But after some tests, it looks like this issue might be connected with the 16:9 aspect ratio of YoutubePlayer width and height.

For example, when width is 320 and height is 180 or width is 480 and height is 270 the bug with strange icons size occurs but when width is 325 and height is 180 the error is gone.

So maybe this is the thing that we need to pay attention to

from react-native-youtube-iframe.

bpark93 avatar bpark93 commented on May 20, 2024

For example, when width is 320 and height is 180 or width is 480 and height is 270 the bug with strange icons size occurs but when width is 325 and height is 180 the error is gone.

This fixes the video size issue for me too, but the app still freezes and the warning still pops up.

Hi @LonelyCpp , the video isn't on any overlay component. I'll try the other solution you posted.

from react-native-youtube-iframe.

bpark93 avatar bpark93 commented on May 20, 2024

So this is definitely some sort of screen orientation issue. I can reproduce thr exact same error using the expo video component.

I'm really curious as to how you can't reproduce the error at all on your end. Does your demo app have "orientation":"portrait" in app.json? Are you using expo-screen orientation at all?

from react-native-youtube-iframe.

LonelyCpp avatar LonelyCpp commented on May 20, 2024

Does your demo app have "orientation":"portrait" in app.json?

Yes

  1. I tried it with the expo app from the playstore.
  2. Tried it with plain old react native app with orientation locked to portrait and unlocked (in AndroidManifest.xml)
  3. It seems like one can only build expo apps on expo servers 🤔 Let me try that too, just in case.

But all this is on an android 10 device. What android OS are you using?

from react-native-youtube-iframe.

LonelyCpp avatar LonelyCpp commented on May 20, 2024

@Foukz I can reproduce your bug with the specific width and height numbers. I am honestly perplexed, I'll see what I can find

from react-native-youtube-iframe.

esteban199 avatar esteban199 commented on May 20, 2024

Im experimenting the same bug

from react-native-youtube-iframe.

bpark93 avatar bpark93 commented on May 20, 2024

This issue has been fixed for me after a combination of @Razorholt 's fix in @LonelyCpp's second comment, using the onFullScreenChange prop from the fs-callback branch, and updating expo to 38. No more freezing, no more wacky video dimensions.

Use the onFullScreenChange prop to call a function that locks orientation and adjust video dimensions accordingly whenever entering/exiting fullscreen.

from react-native-youtube-iframe.

fawazahmed-yara avatar fawazahmed-yara commented on May 20, 2024

Keep a watch on fullscreen status, update width on change so that iframe readjusts the size.

onFullScreenChange = (fullscreenStatus) => {
  this.setState({ fullscreenStatus })
}

<YoutubePlayer
  onFullScreenChange={this.onFullScreenChange}
  width={this.state.fullscreenStatus ? 0 : videoWidth}
 // ...other props
/>

works great

from react-native-youtube-iframe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.