-
Notifications
You must be signed in to change notification settings - Fork 527
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
How can I load a video from app-folder...for-example assets? #80
Comments
To load a video from your app folder use require: source={{uri: require(‘path/to/video.mp4’)}} To stop auto play on the video pass the paused prop to the component: paused={ true } See more here about video props you can pass through to the video: https://github.com/react-native-community/react-native-video |
Thanks for your help. I have test it ...your the source example isn't works. But it was the right way and take me to the solution. I figured out, this: source={require('./assets/BigBuckBunny_512kb0.mp4')} and it works! :) And thanks for the info-link! I don't know, can use the props from the normal video-component too. Best Regards |
Sorry about that...was texting you from my phone so was going off memory...glad you got it figured out. |
No worries! :) |
@kylemilloy Is there any way to use the same implementation as |
Of course. Pass it like any variable. |
@kylemilloy Thank you for your prompt reply. From my understanding, passing in a variable to In order to get around the
render the component without a
|
Sorry, I fail to see how this would make a difference...in the original code it's explicitly called out that source is passed, in the second we just rely on ...this.props. How does this change this.props.source being used by the Video component? |
The change this makes is now I am able to pass Before I removed I see what you mean that this change seems as though it is only coming full circle, but the exclusion of |
Yeah if you don't mind writing a PR I'd like to test this one myself. I'm having difficulty wrapping my head around how this changes anything. Maybe I'm reading your code wrong? Here's what I'm understanding: In the first we do: <Video
{ ...this.props }
source={ this.props.source }
/> We explicitly call out source and pass it on. In the second we do: <Video { ...this.props } /> And rely on passing the source with the spread operator with the rest of the props. To me, it's the exact same thing...isn't it? Like, you can do... <VideoPlayer source={{ uri: 'path/to/file' }} /> ...now already...or you can use require to import it from the RN directory. Sorry again...maybe there's some black magic going on that I'm not aware of behind the scenes or maybe I just don't understand the problem. |
if i remove the line with "source={this.props.source}", it's ok to use source={{uri: this.state.dir}} ? a dymamic local file ? i will select the file in a list and the path will stored in state dir, i have five videos and require is not dynamic |
Hi,
I'll get the videos of the assets-file-folder from the react-native app.
How can i do this with this component?
Because, if i wrote the uri with URL to the folder, the video don't show, the player loads and loads, but don't play.
for Example: source={{ uri: '/Recovered References/BigBuckBunny_512kb.mp4'}}
And can i change the option, that the video only starts, if i touch the play-button.
Thanks for help
The text was updated successfully, but these errors were encountered: