0

everyone! while trying to show a video in my react native app I face issues, the error is: "undefined is not an object (evaluating 'this.onbuffer')"

This is the code.

import * as React from 'react'; import { View, Text, TouchableOpacity, StyleSheet } from 'react-native'; import Video from 'react-native-video'

function VideoScreen() { return (

    <Video source={{uri: "../assets/videos/maula.mp4"}}   // Can be a URL or a local file.
        ref={(ref) => {
                 this.player = ref
               }}                                      // Store reference
               onBuffer={this.onBuffer}                // Callback when remote video is buffering
               onError={this.videoError}
                      // Callback when video cannot be loaded
           style={styles.container} />

);

}

const styles = StyleSheet.create({ container: { position: 'absolute', top: 0, left: 0, bottom: 0, right: 0, }, });

export default VideoScreen;

Can someone help me?

1 Answer 1

0

check if you've added this in your constructor

constructor(props) {
    super(props);
    this.onBuffer= this.onBuffer.bind(this);
  }
Sign up to request clarification or add additional context in comments.

2 Comments

Glad it helped, just mark it as answered if you don't have further questions.
Yet, I am facing the problem of missing semicolon in the constructor. I tried to add ; but didn't work. can you help me. Thanks in advance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.