VrVideoView play normal video - android

YouTube already has such function "play in CardBoard" which will reformat the footage to make it feel like you are watching in an Imax theatre.
How to do it with android VR Sdk. i'm takeing look at VrVideoView. When playing an normal video, It generate very strange view point for the normal 2D video and play it as 3D video.

The VrVideoView only renders the video in a 360° way and it gives an awfull result if the video is not a 360° video.
So you have to use a GvrView and manage the renderring youself in order to have a good result.
Here's a quick and dirty example about how to display a stereoscopic video with the Google VR SDK
https://github.com/Zanfas/Cardboard_VideoPlayer
You have to know that the Google VR SDK only apply distorsion to the rendering of a 3D Scene managed with Open GL ES.
The idea is to make a virtual screen in a 3D scene that displays the video. You render the 3D scene with the camera looking at that screen and there you go.
Regards

Related

Display Video in a Augmented image

I am developing an augmented reality app in Android using ARCore library.
I would like to play a video in Augmented image.
I can able to successfully identify an object using ARCore Android
But I am not able to play a video exactly on the augmented image.
Any help would be appreciated.
Here are 5 features you have to check to make sure your app's algorithm is OK:
You have a Supported file format of Video Asset (mp4 is robust choice).
You have an ArAnchor which your Video Object is attached to.
You have a geometry which your mp4 Video texture is assigned to.
You are rendering your Video Object.
The logic of video player is true.
Look at Clayton Wilkinson's brilliant answer in Need to play Video in ARCore SO post.

How to create dual view for Youtube in Android VR app?

I want to create an app that allows you to watch regular Youtube videos in a VR headset (that's normal videos, not VR 360 videos).
Does anyone know how to embed two youtube viewers in the same activity, playing the same video to create the stereoscopic views for a VR type app?
It doesn't seem you can do with with the Youtube Android API as it only lets you play one Youtube viewer at a time.
It's definitely possible, as this app shows ...
https://play.google.com/store/apps/details?id=com.ekm.youtubevr3dvideos
Thanks in advance.
As stated by #Tempus, you can use the Google Cardboard which lets you experience virtual reality in a simple and fun way. With Cardboard and the YouTube mobile app, you can even watch 360 degree videos for an immersive experience.
Also, you can check this documentation on how to embed VR view.
VR View sample code:
There are two sample apps which demonstrate the VR View functionality in the SDK: simplepanowidget and simplevideowidget. Both of these samples are single activity applications that display an embedded panoramic image or video using VrPanoramaView and VrVideoView, respectively.

How to get the 360 VR video in the correct format for Android VR View

I think I figured out the issue i'm facing with my original question here. When I downloaded the 360 videos they look like a normal video file like this:
But for the VR View to work properly, the video needs to be split like this:
Is there any way I can convert the downloaded 360 videos into the VR (dual screen) format or can I programmatically set my app to accept the 360 mp4 file and display without overly zooming in or out on certain areas on the video?
Extract from my xml file:
<com.google.vr.sdk.widgets.video.VrVideoView
android:id="#id/video_view"
android:layout_width="match_parent"
android:layout_height="250dip"
android:scrollbars="null" />
I downloaded the video you linked to and was able to get it to play properly using the VrVideoView in both regular and goggle modes. The video you linked to is not a stereoscopic video, but is a monoscopic video.
For the clarity of this answer, I'll briefly explain the two types of VR videos supported by Google's VR SDK: Monoscopic and Stereoscopic videos. With monoscopic, the video was shot with only one camera and when viewed in a regular player, it looks like the top image in your question, with all the distortions. With stereoscopic, the video was shot using two cameras and depending on the stereoscopic format (there's top/bottom and left/right), it will look like the bottom image in your question when viewed with a regular player and will also look distorted. Google's VR player only supports the top/bottom version of the stereoscopic format.
If the video you are attempting to play is a monoscopic 360 video (as is the case with the linked video), then you can play it using the VR SDK as follows:
VrVideoView vrVideoView;
// initialize the view here
Options options = new Options();
// This tells the player that the video is a monoscopic 360 video
options.inputType = Options.TYPE_MONO;
// This tells the player that it should play using HLS or progressive video play
// If you are linking to a single video file, use default.
options.inputFormat = Options.FORMAT_DEFAULT;
// Assuming you've downloaded the video...
vrVideoView.loadVideoFromAssets("my-video.mp4", options);
vrVideoView.playVideo();
Now if you are playing a stereoscopic top/bottom format 360 video, then you can similarly play it by just altering the input type of the video:
VrVideoView vrVideoView;
// initialize the view here
Options options = new Options();
// This tells the player that the video is a stereoscopic top/bottom 360 video
options.inputType = Options.TYPE_STEREO_OVER_UNDER;
// This tells the player that it should play using HLS or progressive video play
// If you are linking to a single video file, use default.
options.inputFormat = Options.FORMAT_DEFAULT;
// Assuming you've downloaded the video...
vrVideoView.loadVideoFromAssets("my-video.mp4", options);
vrVideoView.playVideo();
Now, you probably want to play this video using goggles. In this case, you can simply set the display mode of the VR player. The embedded mode is the regular small player that fits into your UI and acts as a small one-eyed viewport into the 360 video, with distortions corrected. The fullscreen monoscopic mode is similar to embedded in that is is the same one-eyed perspective, but instead the device's entire screen is used as the viewport. The fullscreen stereo option will split the video into two images, one for each eye, and will be viewable with the VR goggles. See below for the code to do this (note: this code can be called anytime after the VrVideoView is constructed and it will adjust accordingly):
// This displays the video as inside the normal bounds for viewing without the VR goggles.
vrVideoView.setDisplayMode(DisplayMode.EMBEDDED);
// If you want to go full-screen without goggles...
vrVideoView.setDisplayMode(DisplayMode.FULLSCREEN_MONO);
// If you want to go full-screen and use goggles...
vrVideoView.setDisplayMode(DisplayMode.FULLSCREEN_STEREO);
There might be some confusion surrounding the naming of the Options and the DisplayMode. The Options are simply used by the player to determine whether the source video has one perspective or two. The DisplayMode is used by the player to determine how to display that video. You can have a monoscopically shot video that is displayed stereoscopically, it will just have each eye seeing the same perspective. Likewise, you can have a stereoscopically shot video displayed monoscopically, it's just that the viewport will only be displaying one eye's perspective and the other perspective will be ignored.
I hope that clears things up. Let me know if you have still have trouble playing the video.

Android: render textureview of 2D video in side-by-side

I am trying to create an video player app which is capable of displaying a 2D video in a side-by-side projection for cardboard. The input is a 2D video, so no need for head tracking. I checked the Google Cardboard SDKs but they don't provide an implementation for simple side-by-side projections with Non-3D or 360° contents.
My current implementation of the video player already uses a TextureView to render the video.
I found a sample code for side-by-side-camera preview: [android Side By Side Camera
How do I get the output from the TextureView of my video player into a GvrView?

play video with qcar and android AR application

I am developing an android application in which a specific video is played when the poster of a specific movie is shown infront of the camera in android, i found many AR tutorial just show 3D object when detect a pattern, i need some advice to make application that can play video with AR application using android camera and qcar SDK
I don't know qcar, but of course you can put a SurfaceView upon an existing SurfaceView from your CameraPreview and play a video in it.
What I would do is implementing your poster-recognition logic, this will be tricky enough and then, If it works reliable, I would add another SurfaceView in which the video is played.
You will find out, that the CameraPreview surface has actually to be on top of the video surface.
I assume you are trying to play video on glsurface ,it is possible by using surface video texture ,but only ics(4.0) and above devices support surface video texture.Vuforia have a very good sample of this here,you can handle what to do for lower devices such as playing video fullscreen etc..

Categories

Resources