コード例 #1
0
ファイル: BgaEntity.java プロジェクト: keigen-shu/open2jam
 public void release() {
   if (!isVideo) return;
   player.stop();
   player.release();
   playerFactory.release();
   player = null;
   playerFactory = null;
 }
コード例 #2
0
 /**
  * Construct a media player component.
  *
  * @param bufferFormatCallback callback used to set video buffer characteristics
  */
 public DirectMediaPlayerComponent(BufferFormatCallback bufferFormatCallback) {
   // Create the native resources
   mediaPlayerFactory = onGetMediaPlayerFactory();
   mediaPlayer =
       mediaPlayerFactory.newDirectMediaPlayer(bufferFormatCallback, onGetRenderCallback());
   // Register listeners
   mediaPlayer.addMediaPlayerEventListener(this);
   // Sub-class initialisation
   onAfterConstruct();
 }
コード例 #3
0
ファイル: BgaEntity.java プロジェクト: keigen-shu/open2jam
 public void initVideo() {
   if (!isVideo) return;
   try {
     playerFactory = new MediaPlayerFactory(new String[] {"--no-video-title-show", "--noaudio"});
     player = playerFactory.newDirectMediaPlayer("RGBA", WIDTH, HEIGHT, WIDTH * DEPTH, this);
     player.prepareMedia(videoFile.getAbsolutePath());
   } catch (Throwable t) {
     isVideo = false;
     t.printStackTrace();
     Logger.global.log(Level.WARNING, "VLC failed to load :(");
   }
 }
コード例 #4
0
 /**
  * Construct a media player component.
  *
  * @param format video format
  * @param width video width
  * @param height video height
  * @param pitch video pitch (also known as "stride")
  * @deprecated use {@link #DirectMediaPlayerComponent(BufferFormatCallback)} instead
  */
 @Deprecated
 public DirectMediaPlayerComponent(String format, int width, int height, int pitch) {
   // Create the native resources
   mediaPlayerFactory = onGetMediaPlayerFactory();
   mediaPlayer =
       mediaPlayerFactory.newDirectMediaPlayer(
           format, width, height, pitch, onGetRenderCallback());
   // Register listeners
   mediaPlayer.addMediaPlayerEventListener(this);
   // Sub-class initialisation
   onAfterConstruct();
 }
コード例 #5
0
ファイル: BgaEntity.java プロジェクト: keigen-shu/open2jam
  @Override
  public void judgment() {
    if (isVideo && !isPlaying) {
      float w = (float) (scale_w / WIDTH);
      float h = (float) (scale_h / HEIGHT);
      sprite.setScale(w, h);
      player.play();
      isPlaying = true;
    } else {
      if (next_sprites.isEmpty()) return;
      if (times.isEmpty()) return;

      times.removeLast();
      this.sprite = next_sprites.removeLast();
      this.width = sprite.getWidth();
      this.height = sprite.getHeight();
    }
  }
コード例 #6
0
 /**
  * Release the media player component and the associated native media player resources.
  *
  * <p>The associated media player factory will <em>not</em> be released, the client application is
  * responsible for releasing the factory at the appropriate time.
  */
 public final void release() {
   onBeforeRelease();
   mediaPlayer.release();
   onAfterRelease();
 }