28package com.jogamp.opengl.demos.androidfat;
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.android.LauncherUtil.OrderedProperties;
39import com.jogamp.opengl.demos.av.MovieCube;
41import jogamp.newt.driver.android.NewtBaseActivity;
43import com.jogamp.common.net.Uri;
44import com.jogamp.common.util.IOUtil;
45import com.jogamp.newt.NewtFactory;
46import com.jogamp.newt.event.MouseAdapter;
47import com.jogamp.newt.event.MouseEvent;
48import com.jogamp.newt.opengl.GLWindow;
49import com.jogamp.opengl.util.Animator;
50import com.jogamp.opengl.util.av.GLMediaPlayer;
51import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
52import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
54import android.os.Bundle;
55import android.util.Log;
58 static String TAG =
"MovieCubeActivity0";
64 ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(
true);
71 props.
setProperty(
"jnlp.media0_url0",
"https://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4");
72 props.
setProperty(
"jnlp.media1_url1",
"https://archive.org/download/ElephantsDream/ed_1024_512kb.mp4");
73 props.
setProperty(
"jnlp.media0_url2",
"file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
86 props.
setProperty(
"jogl.debug.GLMediaPlayer",
"true");
101 public void onCreate(
final Bundle savedInstanceState) {
102 Log.d(TAG,
"onCreate - 0");
106 super.onCreate(savedInstanceState);
108 final String[] streamLocs =
new String[] {
109 System.getProperty(
"jnlp.media0_url0"),
110 System.getProperty(
"jnlp.media0_url1"),
111 System.getProperty(
"jnlp.media0_url2") };
112 final Uri streamLoc = getUri(streamLocs, 0,
false);
113 if(
null == streamLoc) {
throw new RuntimeException(
"no media reachable: "+Arrays.asList(streamLocs)); }
121 Log.d(TAG,
"req caps: "+capsMain);
134 setContentView(getWindow(), glWindowMain);
135 anim.
add(glWindowMain);
144 System.err.println(
"MovieCubeActivity0 AttributesChanges: "+eventMask+
", when "+when);
145 System.err.println(
"MovieCubeActivity0 State: "+mp);
156 se.printStackTrace();
158 getActivity().finish();
163 }
catch (
final IOException e) {
169 Log.d(TAG,
"onCreate - X");
172 static Uri getUri(
final String path[],
final int off,
final boolean checkAvail) {
174 for(
int i=off;
null==uri && i<path.length; i++) {
175 if(
null != path[i] && path[i].length()>0) {
177 final URLConnection uc = IOUtil.getResource(path[i],
null);
180 uri = Uri.valueOf(uc.getURL());
181 }
catch (
final URISyntaxException e) {
184 if( uc instanceof HttpURLConnection ) {
185 ((HttpURLConnection)uc).disconnect();
190 uri = Uri.cast(path[i]);
191 }
catch (
final URISyntaxException e) {
195 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.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
void setSampleBuffers(final boolean enable)
Defaults to false.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
final void setProperty(final String key, final String value)
final void setSystemProperties()
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.