TheWidlarzGroup / react-native-video-player

A video player for React Native with controls
MIT License
515 stars 315 forks source link

At the end of the play, typeError. #84

Closed rj9676564 closed 5 years ago

rj9676564 commented 6 years ago

Exapmle code,

<VideoPlayer
            endWithThumbnail
            thumbnail={{uri: this.state.thumbnailUrl}}
            video={{uri: this.state.videoUrl}}
            videoWidth={this.state.video.width}
            videoHeight={this.state.video.height}
            duration={this.state.video.duration/* I'm using a hls stream here, react-native-video
              can't figure out the length, so I pass it here from the vimeo config */}
            ref={r => this.player = r}
          />

at the end of the play

TypeError:null is not an object(evaluating '_this2.palyer.seek')
    this error is located at:
    in videoplayer(at index.js:35)
<VideoPlayer
            endWithThumbnail={false}
            thumbnail={{uri: this.state.thumbnailUrl}}
            video={{uri: this.state.videoUrl}}
            videoWidth={this.state.video.width}
            videoHeight={this.state.video.height}
            duration={this.state.video.duration/* I'm using a hls stream here, react-native-video
              can't figure out the length, so I pass it here from the vimeo config */}
            ref={r => this.player = r}
          />

If this is the case, Error will not occur. Thank you!

lossen commented 6 years ago

I have the same error. For me the issue appears only on android and for you? I removed endWithThumbnail and it helped me.

cornedor commented 6 years ago

@laibinCN you might have a typo, in _this2.palyer.seek is player written incorrectly. I can't find "palyer" the code on GitHub.

rj9676564 commented 6 years ago

@cornedor yes,I was very careless。_this2.player.seek image

jamsch commented 6 years ago

Occurs on iOS @ RN 0.55.0 for me. Android@0.54.2 seems fine. Gathering more info..

 <VideoPlayer
      thumbnail={component.thumbnail ? { uri: component.thumbnail } : undefined}
      fullScreenOnLongPress
      video={{ uri: component.url }}
      videoWidth={400}
      videoHeight={225}
      loop={false}
      endWithThumbnail={Platform.OS === 'ios'}
    />
alprtv commented 6 years ago

try yarn add react-native-video-player@0.9.0 it's worked for me

melissayu commented 6 years ago

I get the same error with 0.9.1. Downgrading to 0.9.0 also fixed it for me.

jeswinsimon commented 5 years ago

Duplicate of #79

cornedor commented 5 years ago

This should now be fixed in the latest version.