Coder Social home page Coder Social logo

Comments (4)

 avatar commented on July 23, 2024

Facing the same issue, pause method doesn't work. @abbasfreestyle Please look into this issue.

from react-native-af-video-player.

abbasfreestyle avatar abbasfreestyle commented on July 23, 2024

@V3RT1AG0

Just tested it and seems to be working for me. Can you share your code?

from react-native-af-video-player.

V3RT1AG0 avatar V3RT1AG0 commented on July 23, 2024

The code is not working only when I use this library along with react-native-swiper. Else pause is working perfectly. Closing this issue as the issue seems to be with react-native-swiper itself.

from react-native-af-video-player.

 avatar commented on July 23, 2024

Same here, seems like an issue when used with swipe library. When swiped right the main video doesn't pause.

@abbasfreestyle Can you please try this out?

const React = require("react");
import { Text, StyleSheet, View, Button, Image } from "react-native";

import Video from "react-native-af-video-player";
import Swiper from "react-native-swiper";

export default class Swiper1 extends React.Component {
  constructor(props) {
    super(props);
    this.trigger = this.trigger.bind(this);
    this.play = this.play.bind(this);
    this.pause = this.pause.bind(this);
  }

  static navigationOptions = {
    header: null
  };

  trigger() {
    this.video.pause();
  }

  play() {
    this.video.play();
  }

  pause() {
    this.video.pause();
  }

  render() {
    return (
      <React.Fragment>
        <Swiper onMomentumScrollEnd={this.trigger}>
          <View style={styles.slide1}>
            <Video
              url={"https://www.rmp-streaming.com/media/bbb-360p.mp4"}
              ref={ref => {
                this.video = ref;
              }}
            />
            <Button onPress={this.play} title="play" />
            <Button onPress={this.pause} title="pause" />
          </View>
          <View style={styles.slide2}>
            <Text style={styles.text}>Beautiful</Text>
          </View>
          <View style={styles.slide3}>
            <Text style={styles.text}>And simple</Text>
          </View>
        </Swiper>
      </React.Fragment>
    );
  }
}

const styles = StyleSheet.create({
  wrapper: {},
  slide1: {
    flex: 1
  },
  slide2: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#97CAE5"
  },
  slide3: {
    flex: 1,
    justifyContent: "center",
    alignItems: "center",
    backgroundColor: "#92BBD9"
  },
  text: {
    color: "#fff",
    fontSize: 30,
    fontWeight: "bold"
  }
});

from react-native-af-video-player.

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.