28package com.jogamp.opengl.demos.android;
30import java.io.IOException;
31import java.net.HttpURLConnection;
32import java.net.URISyntaxException;
33import java.net.URLConnection;
34import java.util.Arrays;
36import com.jogamp.opengl.GLCapabilities;
37import com.jogamp.opengl.GLProfile;
38import com.jogamp.opengl.demos.av.MovieCube;
40import jogamp.newt.driver.android.NewtBaseActivity;
42import com.jogamp.common.net.Uri;
43import com.jogamp.common.util.IOUtil;
44import com.jogamp.newt.NewtFactory;
45import com.jogamp.newt.event.MouseAdapter;
46import com.jogamp.newt.event.MouseEvent;
47import com.jogamp.newt.opengl.GLWindow;
48import com.jogamp.opengl.util.Animator;
49import com.jogamp.opengl.util.av.GLMediaPlayer;
50import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
51import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
52import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
54import android.os.Bundle;
55import android.util.Log;
58 static String TAG =
"MovieCubeActivity0a";
64 ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(
true);
70 public void onCreate(
final Bundle savedInstanceState) {
71 super.onCreate(savedInstanceState);
73 final String[] streamLocs =
new String[] {
74 System.getProperty(
"jnlp.media0_url0"),
75 System.getProperty(
"jnlp.media0_url1"),
76 System.getProperty(
"jnlp.media0_url2") };
77 final Uri streamLoc = getUri(streamLocs, 0,
false);
78 if(
null == streamLoc) {
throw new RuntimeException(
"no media reachable: "+Arrays.asList(streamLocs)); }
95 setContentView(getWindow(), glWindowMain);
96 anim.
add(glWindowMain);
105 System.err.println(
"MovieCubeActivity0 AttributesChanges: "+eventMask+
", when "+when);
106 System.err.println(
"MovieCubeActivity0 State: "+mp);
117 se.printStackTrace();
119 getActivity().finish();
124 }
catch (
final IOException e) {
130 Log.d(TAG,
"onCreate - X");
133 static Uri getUri(
final String path[],
final int off,
final boolean checkAvail) {
135 for(
int i=off;
null==uri && i<path.length; i++) {
136 if(
null != path[i] && path[i].length()>0) {
138 final URLConnection uc = IOUtil.getResource(path[i],
null);
141 uri = Uri.valueOf(uc.getURL());
142 }
catch (
final URISyntaxException e) {
145 if( uc instanceof HttpURLConnection ) {
146 ((HttpURLConnection)uc).disconnect();
151 uri = Uri.cast(path[i]);
152 }
catch (
final URISyntaxException e) {
156 Log.d(TAG,
"Stream: <"+path[i]+
">: "+(
null!=uri));
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
static Display createDisplay(final String name)
Create a Display entity.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
abstract int addReference()
See Display#addReference().
abstract int removeReference()
See Display#removeReference().
Pointer event of type PointerType.
final int getPointerCount()
See details for multiple-pointer events.
final float getPressure(final boolean normalized)
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void addMouseListener(final MouseListener l)
Appends the given MouseListener to the end of the list.
final boolean setFullscreen(final boolean fullscreen)
Enable or disable fullscreen mode for this window.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
void onCreate(final Bundle savedInstanceState)
Simple cube movie player w/ aspect ration true projection on a cube.
GLMediaPlayer getGLMediaPlayer()
static final float zoom_def
void playStream(final Uri streamLoc, final int vid, final int aid, final int textureCount)
final void resetFPSCounter()
Reset all performance counter (startTime, currentTime, frame number)
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.