public class PresentationPlayer
extends java.lang.Object
implements com.aspose.ms.System.IDisposable
Represents the player of animations associated with the Presentation.
Presentation pres = new Presentation("pres.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(pres); try { // Play animation with 33 FPS PresentationPlayer player33 = new PresentationPlayer(animationsGenerator, 33); try { player33.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("33fps/frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); animationsGenerator.run(pres.getSlides()); } finally { if (player33 != null) player33.dispose(); } // Play animation with 45 FPS PresentationPlayer player45 = new PresentationPlayer(animationsGenerator, 45); try { player45.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("45fps/frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); animationsGenerator.run(pres.getSlides()); } finally { if (player45 != null) player45.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (pres != null) pres.dispose(); }
| Modifier and Type | Class and Description |
|---|---|
static interface |
PresentationPlayer.FrameTick
Represents the frame tick handler of
FrameTickDelegate event. |
| Constructor and Description |
|---|
PresentationPlayer(PresentationAnimationsGenerator generator,
double fps)
Creates new instance of the
PresentationPlayer. |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Disposes the instance of the
PresentationPlayer. |
int |
getFrameIndex()
Gets the frame index.
|
void |
setFrameTick(PresentationPlayer.FrameTick event)
Set a new frame tick event.
|
public PresentationPlayer(PresentationAnimationsGenerator generator, double fps)
Creates new instance of the PresentationPlayer.
generator - Presentation animations generatorfps - Frames per second (FPS)public final void dispose()
Disposes the instance of the PresentationPlayer.
dispose in interface com.aspose.ms.System.IDisposablepublic final int getFrameIndex()
Gets the frame index.
Presentation pres = new Presentation("pres.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(pres); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { player.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); animationsGenerator.run(pres.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (pres != null) pres.dispose(); }
public void setFrameTick(PresentationPlayer.FrameTick event)
Set a new frame tick event.
Presentation pres = new Presentation("pres.pptx"); try { PresentationAnimationsGenerator animationsGenerator = new PresentationAnimationsGenerator(pres); try { PresentationPlayer player = new PresentationPlayer(animationsGenerator, 33); try { player.setFrameTick(new PresentationPlayer.FrameTick() { public void invoke(PresentationPlayer sender, FrameTickEventArgs args) { FileOutputStream fos = null; try { fos = new FileOutputStream("frame_" + sender.getFrameIndex() + ".png"); args.getFrame().compress(android.graphics.Bitmap.CompressFormat.PNG, 100, fos); } catch (IOException e) { throw new RuntimeException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); animationsGenerator.run(pres.getSlides()); } finally { if (player != null) player.dispose(); } } finally { if (animationsGenerator != null) animationsGenerator.dispose(); } } finally { if (pres != null) pres.dispose(); }
PresentationAnimationsGenerator is generated by the player.
event - Frame tick event.Copyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.