Sanman
Sanman

Reputation: 1158

React-Native play video using expo sdk

I want to play a video from url using expo sdk for react native.I read the sdk but I am unable to understand how to make it work. Here is link for expo sdk video docs.

Here is my code

 import React from 'react';
import { StyleSheet, Text, View,Button } from 'react-native';
import { Video } from 'expo';

export default class App extends React.Component {
    _handleVideoRef = component => {

    }

    onPlayPressed(){

    }

  render() {

    return (
      <View style={styles.container}>
            <Expo.Video
            source = {{uri :'url for video'}}
            ref={this._handleVideoRef}

            />
            <Text>Open up App.js to start working on your app! </Text>
            <Button onPress={this.onPlayPressed.bind(this)} title = "Play"/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Doc says video tag works as inline but I am not sure why it not playing video or anything more is needed.

Thanks for any help

Upvotes: 1

Views: 3521

Answers (1)

Burak Tokak
Burak Tokak

Reputation: 1860

import { Video } from 'expo';

You imported the Expo.Video module as Video, but you are trying to use that component via Expo.Video.

<Video
  source = {{uri :'url for vide'}}
  ref={this._handleVideoRef}
/>

Use it like this. Not Expo.Video

Upvotes: 2

Related Questions