all pages
final MTMovieClip clip3 = new MTMovieClip("someVideo.mp4", new Vertex(300, 300), 30 ,pa); clip3.removeAllGestureEventListeners(ScaleProcessor.class); clip3.registerInputProcessor(new ScaleProcessor(getMTApplication())); clip3.addGestureListener(ScaleProcessor.class, new IGestureEventListener() { public boolean processGestureEvent(MTGestureEvent ge) { ScaleEvent se = (ScaleEvent)ge; delta += (se.getScaleFactorX() -1.0f) ; if (se.getId() == ScaleEvent.GESTURE_DETECTED){ delta = 0.0f; startTime = clip3.getVideoTexture().getTime(); clip3.getVideoTexture().pause(); } else if (se.getId() == ScaleEvent.GESTURE_UPDATED){ if (se.getScaleFactorX() != 1.0f){ clip3.getVideoTexture().jump(startTime + delta * 50); //this can be tweaked } } else if (se.getId() == ScaleEvent.GESTURE_ENDED){ delta = 0.0f; clip3.getVideoTexture().play(); } return false; } });
Category: Snippets
|