public class AudioFrame extends PictureFrame implements IAudioFrame
Represents an audio clip on a slide.
The following examples shows how to change Audio Play Options.Presentation pres = new Presentation("AudioFrameEmbed_out.pptx"); try { // Gets the AudioFrame shape AudioFrame audioFrame = (AudioFrame)pres.getSlides().get_Item(0).getShapes().get_Item(0); // Sets the Play mode to play on click audioFrame.setPlayMode(AudioPlayModePreset.OnClick); // Sets the volume to Low audioFrame.setVolume(AudioVolumeMode.Low); // Sets the audio to play across slides audioFrame.setPlayAcrossSlides(true); // Disables loop for the audio audioFrame.setPlayLoopMode(false); // Hides the AudioFrame during the slide show audioFrame.setHideAtShowing(true); // Rewinds the audio to start after playing audioFrame.setRewindAudio(true); // Saves the PowerPoint file to disk pres.save("AudioFrameEmbed_changed.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
| Modifier and Type | Method and Description |
|---|---|
int |
getAudioCdEndTrack()
Returns or sets a last track index
Read/write
int. |
int |
getAudioCdEndTrackTime()
Returns or sets a last track time.
|
int |
getAudioCdStartTrack()
Returns or sets a start track index.
|
int |
getAudioCdStartTrackTime()
Returns or sets a start track time.
|
ICaptionsCollection |
getCaptionTracks()
Gets the collection of closed captions associated with the audio frame.
|
boolean |
getEmbedded()
Determines whether a sound is embedded to a presentation.
|
IAudio |
getEmbeddedAudio()
Returns or sets embedded audio object.
|
float |
getFadeInDuration()
Specifies the time duration for the initial fade-in of the media in milliseconds.
|
float |
getFadeOutDuration()
Specifies the time duration for the ending fade-out of the media in milliseconds.
|
boolean |
getHideAtShowing()
Determines whether an AudioFrame is hidden.
|
java.lang.String |
getLinkPathLong()
Returns or sets the name of an audio file which is linked to an AudioFrame.
|
boolean |
getPlayAcrossSlides()
Determines whether audio is playing across the slides.
|
boolean |
getPlayLoopMode()
Determines whether an audio is looped.
|
int |
getPlayMode()
Returns or sets the audio play mode.
|
boolean |
getRewindAudio()
Determines whether audio is automatically rewinded to start after playing.
|
float |
getTrimFromEnd()
Specifies the time duration to be removed from the end of the media during playback, in milliseconds.
|
float |
getTrimFromStart()
Specifies the time duration to be removed from the beginning of the media during playback, in milliseconds.
|
int |
getVolume()
Returns or sets the audio volume.
|
float |
getVolumeValue()
Returns or sets the audio volume in percents.
|
void |
setAudioCdEndTrack(int value)
Returns or sets a last track index
Read/write
int. |
void |
setAudioCdEndTrackTime(int value)
Returns or sets a last track time.
|
void |
setAudioCdStartTrack(int value)
Returns or sets a start track index.
|
void |
setAudioCdStartTrackTime(int value)
Returns or sets a start track time.
|
void |
setEmbeddedAudio(IAudio value)
Returns or sets embedded audio object.
|
void |
setFadeInDuration(float value)
Specifies the time duration for the initial fade-in of the media in milliseconds.
|
void |
setFadeOutDuration(float value)
Specifies the time duration for the ending fade-out of the media in milliseconds.
|
void |
setHideAtShowing(boolean value)
Determines whether an AudioFrame is hidden.
|
void |
setLinkPathLong(java.lang.String value)
Returns or sets the name of an audio file which is linked to an AudioFrame.
|
void |
setPlayAcrossSlides(boolean value)
Determines whether audio is playing across the slides.
|
void |
setPlayLoopMode(boolean value)
Determines whether an audio is looped.
|
void |
setPlayMode(int value)
Returns or sets the audio play mode.
|
void |
setRewindAudio(boolean value)
Determines whether audio is automatically rewinded to start after playing.
|
void |
setTrimFromEnd(float value)
Specifies the time duration to be removed from the end of the media during playback, in milliseconds.
|
void |
setTrimFromStart(float value)
Specifies the time duration to be removed from the beginning of the media during playback, in milliseconds.
|
void |
setVolume(int value)
Returns or sets the audio volume.
|
void |
setVolumeValue(float value)
Returns or sets the audio volume in percents.
|
getPictureFormat, getPictureFrameLock, getRelativeScaleHeight, getRelativeScaleWidth, getShapeType, isCameo, setRelativeScaleHeight, setRelativeScaleWidth, setShapeTypecreateShapeElements, getAdjustments, getGeometryPaths, getShapeStyle, setGeometryPath, setGeometryPathsaddPlaceholder, getAlternativeText, getAlternativeTextTitle, getBasePlaceholder, getBlackWhiteMode, getConnectionSiteCount, getCustomData, getEffectFormat, getFillFormat, getFrame, getHeight, getHidden, getHyperlinkClick, getHyperlinkManager, getHyperlinkMouseOver, getImage, getImage, getLineFormat, getName, getOfficeInteropShapeId, getParent_Immediate, getParentGroup, getPlaceholder, getPresentation, getRawFrame, getRotation, getShapeLock, getSlide, getThreeDFormat, getThumbnail, getThumbnail, getUniqueId, getWidth, getX, getY, getZOrderPosition, isDecorative, isGrouped, isTextHolder, removePlaceholder, setAlternativeText, setAlternativeTextTitle, setBlackWhiteMode, setDecorative, setFrame, setHeight, setHidden, setHyperlinkClick, setHyperlinkMouseOver, setName, setRawFrame, setRotation, setWidth, setX, setY, writeAsSvg, writeAsSvgequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPictureFormat, getPictureFrameLock, getRelativeScaleHeight, getRelativeScaleWidth, setRelativeScaleHeight, setRelativeScaleWidthcreateShapeElements, getAdjustments, getGeometryPaths, getShapeStyle, getShapeType, setGeometryPath, setGeometryPaths, setShapeTypeaddPlaceholder, getAlternativeText, getAlternativeTextTitle, getBasePlaceholder, getBlackWhiteMode, getConnectionSiteCount, getCustomData, getEffectFormat, getFillFormat, getFrame, getHeight, getHidden, getImage, getImage, getLineFormat, getName, getOfficeInteropShapeId, getParentGroup, getPlaceholder, getRawFrame, getRotation, getShapeLock, getThreeDFormat, getThumbnail, getThumbnail, getUniqueId, getWidth, getX, getY, getZOrderPosition, isDecorative, isGrouped, isTextHolder, removePlaceholder, setAlternativeText, setAlternativeTextTitle, setBlackWhiteMode, setDecorative, setFrame, setHeight, setHidden, setName, setRawFrame, setRotation, setWidth, setX, setY, writeAsSvg, writeAsSvggetSlidegetPresentationgetHyperlinkClick, getHyperlinkManager, getHyperlinkMouseOver, setHyperlinkClick, setHyperlinkMouseOverpublic final int getAudioCdStartTrack()
Returns or sets a start track index.
Read/write int.
getAudioCdStartTrack in interface IAudioFramepublic final void setAudioCdStartTrack(int value)
Returns or sets a start track index.
Read/write int.
setAudioCdStartTrack in interface IAudioFramepublic final int getAudioCdStartTrackTime()
Returns or sets a start track time.
Read/write int.
getAudioCdStartTrackTime in interface IAudioFramepublic final void setAudioCdStartTrackTime(int value)
Returns or sets a start track time.
Read/write int.
setAudioCdStartTrackTime in interface IAudioFramepublic final int getAudioCdEndTrack()
Returns or sets a last track index
Read/write int.
getAudioCdEndTrack in interface IAudioFramepublic final void setAudioCdEndTrack(int value)
Returns or sets a last track index
Read/write int.
setAudioCdEndTrack in interface IAudioFramepublic final int getAudioCdEndTrackTime()
Returns or sets a last track time.
Read/write int.
getAudioCdEndTrackTime in interface IAudioFramepublic final void setAudioCdEndTrackTime(int value)
Returns or sets a last track time.
Read/write int.
setAudioCdEndTrackTime in interface IAudioFramepublic final int getVolume()
Returns or sets the audio volume.
Read/write AudioVolumeMode.
getVolume in interface IAudioFramepublic final void setVolume(int value)
Returns or sets the audio volume.
Read/write AudioVolumeMode.
setVolume in interface IAudioFramepublic final int getPlayMode()
Returns or sets the audio play mode.
Read/write AudioPlayModePreset.
getPlayMode in interface IAudioFramepublic final void setPlayMode(int value)
Returns or sets the audio play mode.
Read/write AudioPlayModePreset.
setPlayMode in interface IAudioFramepublic final boolean getHideAtShowing()
Determines whether an AudioFrame is hidden.
Read/write boolean.
getHideAtShowing in interface IAudioFramepublic final void setHideAtShowing(boolean value)
Determines whether an AudioFrame is hidden.
Read/write boolean.
setHideAtShowing in interface IAudioFramepublic final boolean getPlayLoopMode()
Determines whether an audio is looped.
Read/write boolean.
getPlayLoopMode in interface IAudioFramepublic final void setPlayLoopMode(boolean value)
Determines whether an audio is looped.
Read/write boolean.
setPlayLoopMode in interface IAudioFramepublic final boolean getPlayAcrossSlides()
Determines whether audio is playing across the slides.
Read/write boolean.
Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); // Add Audio Frame IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav"); // Set Audio to play across the slides audioFrame.setPlayAcrossSlides(true); // Set Audio to automatically rewind to start after playing audioFrame.setRewindAudio(true); pres.save("AudioFrame_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getPlayAcrossSlides in interface IAudioFramepublic final void setPlayAcrossSlides(boolean value)
Determines whether audio is playing across the slides.
Read/write boolean.
Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); // Add Audio Frame IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav"); // Set Audio to play across the slides audioFrame.setPlayAcrossSlides(true); // Set Audio to automatically rewind to start after playing audioFrame.setRewindAudio(true); pres.save("AudioFrame_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setPlayAcrossSlides in interface IAudioFramepublic final boolean getRewindAudio()
Determines whether audio is automatically rewinded to start after playing.
Read/write boolean.
Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); // Add Audio Frame IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav"); // Set Audio to play across the slides audioFrame.setPlayAcrossSlides(true); // Set Audio to automatically rewind to start after playing audioFrame.setRewindAudio(true); pres.save("AudioFrame_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getRewindAudio in interface IAudioFramepublic final void setRewindAudio(boolean value)
Determines whether audio is automatically rewinded to start after playing.
Read/write boolean.
Presentation pres = new Presentation(); try { ISlide slide = pres.getSlides().get_Item(0); // Add Audio Frame IAudioFrame audioFrame = slide.getShapes().addAudioFrameLinked(50, 50, 100, 100, "sampleaudio.wav"); // Set Audio to play across the slides audioFrame.setPlayAcrossSlides(true); // Set Audio to automatically rewind to start after playing audioFrame.setRewindAudio(true); pres.save("AudioFrame_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setRewindAudio in interface IAudioFramepublic final boolean getEmbedded()
Determines whether a sound is embedded to a presentation.
Read-only boolean.
getEmbedded in interface IAudioFramepublic final java.lang.String getLinkPathLong()
Returns or sets the name of an audio file which is linked to an AudioFrame.
Read/write String.
getLinkPathLong in interface IAudioFramepublic final void setLinkPathLong(java.lang.String value)
Returns or sets the name of an audio file which is linked to an AudioFrame.
Read/write String.
setLinkPathLong in interface IAudioFramepublic final IAudio getEmbeddedAudio()
Returns or sets embedded audio object.
Read/write IAudio.
getEmbeddedAudio in interface IAudioFramepublic final void setEmbeddedAudio(IAudio value)
Returns or sets embedded audio object.
Read/write IAudio.
setEmbeddedAudio in interface IAudioFramepublic final float getFadeInDuration()
Specifies the time duration for the initial fade-in of the media in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the duration of the starting fade for 200ms audioFrame.setFadeInDuration(200f); pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getFadeInDuration in interface IAudioFramepublic final void setFadeInDuration(float value)
Specifies the time duration for the initial fade-in of the media in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the duration of the starting fade for 200ms audioFrame.setFadeInDuration(200f); pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setFadeInDuration in interface IAudioFramepublic final float getFadeOutDuration()
Specifies the time duration for the ending fade-out of the media in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the duration of the ending fade for 500ms audioFrame.setFadeOutDuration(500f); pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getFadeOutDuration in interface IAudioFramepublic final void setFadeOutDuration(float value)
Specifies the time duration for the ending fade-out of the media in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the duration of the ending fade for 500ms audioFrame.setFadeOutDuration(500f); pres.save("AudioFrameFade_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setFadeOutDuration in interface IAudioFramepublic final float getVolumeValue()
Returns or sets the audio volume in percents. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the audio volume for 85% audioFrame.setVolumeValue(85f); pres.save("AudioFrameValue_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
getVolumeValue in interface IAudioFramepublic final void setVolumeValue(float value)
Returns or sets the audio volume in percents. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the audio volume for 85% audioFrame.setVolumeValue(85f); pres.save("AudioFrameValue_out.pptx", SaveFormat.Pptx); } finally { if (pres != null) pres.dispose(); }
setVolumeValue in interface IAudioFramepublic final float getTrimFromStart()
Specifies the time duration to be removed from the beginning of the media during playback, in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the start trimming time 1.5 seconds audioFrame.setTrimFromStart(1500f); } finally { if (pres != null) pres.dispose(); }
getTrimFromStart in interface IAudioFramepublic final void setTrimFromStart(float value)
Specifies the time duration to be removed from the beginning of the media during playback, in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the start trimming time 1.5 seconds audioFrame.setTrimFromStart(1500f); } finally { if (pres != null) pres.dispose(); }
setTrimFromStart in interface IAudioFramepublic final float getTrimFromEnd()
Specifies the time duration to be removed from the end of the media during playback, in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the end trimming time 2 seconds audioFrame.setTrimFromEnd(2000f); } finally { if (pres != null) pres.dispose(); }
getTrimFromEnd in interface IAudioFramepublic final void setTrimFromEnd(float value)
Specifies the time duration to be removed from the end of the media during playback, in milliseconds. Read/write float.
Example:Presentation pres = new Presentation(); try { FileInputStream audioStream = new FileInputStream("sampleaudio.mp3"); IAudio audio = pres.getAudios().addAudio(audioStream, LoadingStreamBehavior.ReadStreamAndRelease); IAudioFrame audioFrame = pres.getSlides().get_Item(0).getShapes().addAudioFrameEmbedded(50, 50, 100, 100, audio); // Set the end trimming time 2 seconds audioFrame.setTrimFromEnd(2000f); } finally { if (pres != null) pres.dispose(); }
setTrimFromEnd in interface IAudioFramepublic final ICaptionsCollection getCaptionTracks()
Gets the collection of closed captions associated with the audio frame.
This property is read-only and returns an ICaptionsCollection containing all caption tracks.
Example:Presentation pres = new Presentation("audio with captions.pptx"); try { for (IShape shape : pres.getSlides().get_Item(0).getShapes()) { if (shape instanceof IAudioFrame) { IAudioFrame audioFrame = (IAudioFrame) shape; // Save the caption track's binary data as a .vtt file for (ICaptions captionTrack : audioFrame.getCaptionTracks()) { FileOutputStream fos = new FileOutputStream(captionTrack.getCaptionId() + ".vtt"); fos.write(captionTrack.getBinaryData()); fos.close(); } } } } finally { if (pres != null) pres.dispose(); }
getCaptionTracks in interface IAudioFrameCopyright © 2004-2025 Aspose Pty Ltd. All Rights Reserved.