From 7905a197ee21e07bb3a6f5ea33fb789c98253af0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 18 May 2023 07:39:37 +0200 Subject: MovieCube: Restart @ EOS --- src/demos/com/jogamp/opengl/demos/av/MovieCube.java | 19 ++++++++++++++----- src/demos/com/jogamp/opengl/demos/av/MovieSimple.java | 8 ++++---- 2 files changed, 18 insertions(+), 9 deletions(-) (limited to 'src/demos/com/jogamp') diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java index 6fafc6dc7..4cd6b09b6 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieCube.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieCube.java @@ -113,8 +113,8 @@ public class MovieCube implements GLEventListener { @Override public void attributesChanged(final GLMediaPlayer mp, final GLMediaPlayer.EventMask eventMask, final long when) { - System.err.println("MovieCube AttributesChanges: "+eventMask+", when "+when); - System.err.println("MovieCube State: "+mp); + System.err.println("MovieCube.0 AttributesChanges: "+eventMask+", when "+when); + System.err.println("MovieCube.0 State: "+mp); if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Size) ) { resetGLState(); } @@ -603,8 +603,8 @@ public class MovieCube implements GLEventListener { @Override public void attributesChanged(final GLMediaPlayer mp, final GLMediaPlayer.EventMask event_mask, final long when) { - System.err.println("MovieCube AttributesChanges: events_mask "+event_mask+", when "+when); - System.err.println("MovieCube State: "+mp); + System.err.println("MovieCube.1 AttributesChanges: events_mask "+event_mask+", when "+when); + System.err.println("MovieCube.1 State: "+mp); if( event_mask.isSet(GLMediaPlayer.EventMask.Bit.Size) ) { if( origSize ) { window.setSurfaceSize(mp.getWidth(), mp.getHeight()); @@ -619,7 +619,16 @@ public class MovieCube implements GLEventListener { if( event_mask.isSet(GLMediaPlayer.EventMask.Bit.Play) ) { anim.resetFPSCounter(); } - if( event_mask.isSet(GLMediaPlayer.EventMask.Bit.Error) || event_mask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) { + if( event_mask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) { + new InterruptSource.Thread() { + @Override + public void run() { + // loop for-ever .. + mc.mPlayer.seek(0); + mc.mPlayer.resume(); + } }.start(); + } + if( event_mask.isSet(GLMediaPlayer.EventMask.Bit.Error) ) { final StreamException se = mc.mPlayer.getStreamException(); if( null != se ) { se.printStackTrace(); diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java index f851cc4e7..643d4c49f 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java @@ -379,8 +379,8 @@ public class MovieSimple implements GLEventListener { @Override public void attributesChanged(final GLMediaPlayer mp, final GLMediaPlayer.EventMask eventMask, final long when) { - System.err.println("MovieSimple AttributesChanges: "+eventMask+", when "+when); - System.err.println("MovieSimple State: "+mp); + System.err.println("MovieSimple.0 AttributesChanges: "+eventMask+", when "+when); + System.err.println("MovieSimple.0 State: "+mp); if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.EOS) ) { new InterruptSource.Thread() { @Override @@ -578,8 +578,8 @@ public class MovieSimple implements GLEventListener { @Override public void attributesChanged(final GLMediaPlayer mp, final GLMediaPlayer.EventMask eventMask, final long when) { - System.err.println("MovieSimple AttributesChanges: "+eventMask+", when "+when); - System.err.println("MovieSimple State: "+mp); + System.err.println("MovieSimple.1 AttributesChanges: "+eventMask+", when "+when); + System.err.println("MovieSimple.1 State: "+mp); final GLWindow window = (GLWindow) mp.getAttachedObject(WINDOW_KEY); final MovieSimple ms = (MovieSimple)mp.getAttachedObject(PLAYER); if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Size) ) { -- cgit v1.2.3