Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why ios close button onChangeState = paused? #122

Closed
toonlab01 opened this issue Mar 28, 2021 · 1 comment
Closed

why ios close button onChangeState = paused? #122

toonlab01 opened this issue Mar 28, 2021 · 1 comment

Comments

@toonlab01
Copy link

toonlab01 commented Mar 28, 2021

49785EE8-A847-4CD8-9DCC-CA651524F72E 사본

import Modal from 'react-native-modal';
import YoutubePlayer from "react-native-youtube-iframe";

      <Modal
        isVisible={video}
        onBackdropPress={ closeVideo }
        style={{
            margin: 0,
            flex:1,
            justifyContent: 'center',
            alignItems: 'center'
        }}
        coverScreen={false}
        backdropOpacity={1}
        >
    <YoutubePlayer
    width={Platform.OS === "ios" ? 'auto' : Constants.WINDOW_WIDTH}
    height={Platform.OS === "ios" ? 'auto' : Constants.WINDOW_HEIGHT}
    play={video}
    onFullScreenChange={onFullScreenChange}
    videoId={id_name}
    initialPlayerParams={{ cc_lang_pref: 'us', showClosedCaptions: true }}
    webViewProps={{
        injectedJavaScript: `
          var element = document.getElementsByClassName('container')[0];
          element.style.position = 'unset';
          element.style.paddingBottom = 'unset';
          true;
        `,
        allowsInlineMediaPlayback: false,
        onLoadStart :()=>{
            setLoad2(true);
        },
        onLoad : ()=>{
            setLoad2(false);
        }
      }}
    // prevent aspect ratio au
    onChangeState={(data)=>{
        if(data=='paused'){
            // closeVideo();
        }else if(data ='unstarted'){
            setLoad2(false);
        }else if(data = 'ended'){
            setLoad2(false);
        }
    }}
    forceAndroidAutoplay={Platform.OS === 'android'}
  />
    {  
         load2 == true  ? <UIActivityIndicator
        style={{
        flex: 1,
        zIndex:1000,
        alignItems: 'center',
        position: 'absolute',
        justifyContent: 'center' }}
        size={40} count={10}
        color='rgb(161,201,138)'
        />   : null
  }
    </Modal> 

B795FD50-8E9F-4C0A-B49A-D5542F4E66EA

I want the modal to close as well when the close button is pressed, but onChangeState is paused and this is also paused. How to close the modal? How do I modify the source to make the YouTube popup appear when you click the thumbnail image, and close the YouTube popup like a modal when you click the close button?

@LonelyCpp
Copy link
Owner

unfortunately there's no way to detect fullscreen enter / exit on ios. there's an issue already here - #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants