georgski / cordova-vr-player

Plugin playing a video in VR View for Android and iOS
Other
8 stars 10 forks source link

Where to put video file? #2

Closed binoculars88 closed 7 years ago

binoculars88 commented 7 years ago

Where do I put the video file? I'm using Ionic 2 and put the video in the same folder as the file where I've put GoogleVRPlayer.playVideo('shark.mp4'); , but this gives me an error after the player opens up:

Error loading video: com.google.android.exoplayer.upstream.FileDataSource$FileDataSourceException: java.io.FileNotFoundException: shark.mp4: open failed: ENOENT (No such file or directory).

Any thoughts?

georgski commented 7 years ago

Hi, sorry the plugin isn't properly documented, but playVideo accepts an absolute path as a parameter. For example, to play a video stored in your app's www directory, you can use the following code (it requires Cordova File Plugin to be installed):

var path = cordova.file.applicationDirectory + 'www/video.mp4';
GoogleVRPlayer.playVideo(path);
binoculars88 commented 7 years ago

Thanks! The error is gone and the video starts to play. However, there's a calibration problem. As a demo, I'm using the video from Google's dev page. In the app, it looks like this. As you can see, the floor and the sky are stitched together in the center. Any idea how to fix this?

georgski commented 7 years ago

The VRVideoView by default expects the video to be a monocular panorama. We ideally should pass this option as parameter, but temporarily you can put the following code here to support stereoscopic videos:

VrVideoView.Options options = new VrVideoView.Options();
options.inputType = VrVideoView.Options.TYPE_STEREO_OVER_UNDER;
videoWidgetView.loadVideo(fileUri, options);
binoculars88 commented 7 years ago

Thanks!!! Works like a charm on both Android and iOS! Awesome plugin!

georgski commented 7 years ago

Thank you, glad it worked! Any pull requests are most welcome.