Moving a Video in Android via the accelerometer
in
Android Processing
•
10 months ago
Hello,
I'm a newbie in Processing, and I'm trying to Display a 360° Video and I want to move in this Video with the accelerometer of an android device. I Build a Prototype with processing, which was a sphere and a Video mapped in it. This worked!
The next step was bringing this to a android device. This was much much more difficult to do so.
Most of the Examples in android Mode (Processing 2.0b7) do not work.
But this is not the Problem, now I'm using the Ketai Library to access the accelerometer Information.
My Problem is Displaying a Video and Moving it.
A sphere does work, but I'm not able to map something on it.
The Video is always on the top.
So I'm back to to the basics and I'm trying to display a simple video with the apwidgets Library. ( http://code.google.com/p/apwidgets/wiki/APVideoViewExample)
This works, I'm Finally able to display a Video. Now there is the new Problem, I couldn't find a way to move anyhow a video. Because it is placed in the Setup area, I think.
So I tried to use the camera to move the perspective to navigate in the Video, but things like text does change its position, the Video stays the same.
Can anyone Help, please?
I'm using the newest android SDK and the newest processing (Today is the 11.12.2012)
Thank you for your time!
I'm a newbie in Processing, and I'm trying to Display a 360° Video and I want to move in this Video with the accelerometer of an android device. I Build a Prototype with processing, which was a sphere and a Video mapped in it. This worked!
The next step was bringing this to a android device. This was much much more difficult to do so.
Most of the Examples in android Mode (Processing 2.0b7) do not work.
But this is not the Problem, now I'm using the Ketai Library to access the accelerometer Information.
My Problem is Displaying a Video and Moving it.
A sphere does work, but I'm not able to map something on it.
The Video is always on the top.
So I'm back to to the basics and I'm trying to display a simple video with the apwidgets Library. ( http://code.google.com/p/apwidgets/wiki/APVideoViewExample)
This works, I'm Finally able to display a Video. Now there is the new Problem, I couldn't find a way to move anyhow a video. Because it is placed in the Setup area, I think.
So I tried to use the camera to move the perspective to navigate in the Video, but things like text does change its position, the Video stays the same.
Can anyone Help, please?
I'm using the newest android SDK and the newest processing (Today is the 11.12.2012)
Thank you for your time!
- import apwidgets.*;
APVideoView videoView;
APWidgetContainer container;
void setup()
{
size(displayWidth, displayHeight, P3D);
container = new APWidgetContainer(this); //create a new widget container
orientation(LANDSCAPE);
int hoeheScreen = 1370;
int breiteScreen = 240;
videoView = new APVideoView(0, 0, hoeheScreen, breiteScreen, false); //create a new video view, without media controller
//videoView = new APVideoView(false); //create a new video view that fills the screen, without a media controller
//videoView = new APVideoView(); //create a new video view that fills the screen, with a media controller
videoView.setVideoPath("/sdcard/p360.mp4"); //specify the path to the video file
container.addWidget(videoView); //place the video view in the container
videoView.start(); //start playing the video
videoView.setLooping(true); //restart the video when the end of the file is reached
}
void draw()
{
background(200); //black background
text(videoView.getDuration(), 10, 10); //display the length of the video in milliseconds
text(videoView.getCurrentPosition(), 10, 30); //visa hur långt videon spelats
camera(70.0, 35.0, 120.0, 50.0, 50.0, 0.0,
0.0, 1.0, 1.0);
}
void keyPressed() {
if (key == CODED) {
if (keyCode == LEFT) {
videoView.seekTo(0); //"rewind"
}
else if (keyCode == RIGHT) {
videoView.start(); //start playing video file
}
else if (keyCode == DPAD) {
videoView.pause(); //pause the playing of the video file
}
else if (keyCode == DOWN) {
videoView.setVideoPath("sdcard/a360.3gp"); //switch to other video file
}
}
}
1