tiero / react-native-360

A React Native wrapper for Google VR Cardboard SDK
MIT License
141 stars 38 forks source link

Load local video file #27

Closed birger-fuehne closed 5 years ago

birger-fuehne commented 5 years ago

How would I go about loading a local video file?

I tried loading it like this: video={require('./Videos/video.mp4')}

and like this video={{ uri: './video.mp4', type: 'mono'}}

I tried placing the video in the Image.xcassets, in the app root where the package.json is, in the same directory as the JS - file that is requesting it, but it only works if I use it from external via https://

I had a look in the code of VideoView.m, which I think is handling the loading of the video. There I learned that if the uri does not start with https, then local asset is assumed:

//Local asset: Can be in the bundle or the uri can be an absolute path of a stored video in the application

My question is - how would I get the absolute path of my video - or how do I add it into the bundle?

Again, I can offer some gratification for getting this work.

birger-fuehne commented 5 years ago

Sometimes your bugreports make you feel so dumb.. I did not properly add the file to the project it seems: Go to "Target" -> Build Phases -> Copy bundle resources, then add the file there. And if it exists, delete, build clean and readd the file.