IT. Expert System.

Android Reference

MediaItem


android.media.videoeditor

Class MediaItem

  • Direct Known Subclasses:
    MediaImageItem, MediaVideoItem


    public abstract class MediaItem
    extends Object
    This abstract class describes the base class for any MediaItem. Objects are defined with a file path as a source data.
    • Field Detail

      • END_OF_FILE

        public static final int END_OF_FILE
        A constant which can be used to specify the end of the file (instead of providing the actual duration of the media item).
        See Also:
        Constant Field Values
      • RENDERING_MODE_BLACK_BORDER

        public static final int RENDERING_MODE_BLACK_BORDER
        When using the RENDERING_MODE_BLACK_BORDER rendering mode video frames are resized by preserving the aspect ratio until the movie matches one of the dimensions of the output movie. The areas outside the resized video clip are rendered black.
        See Also:
        Constant Field Values
      • RENDERING_MODE_STRETCH

        public static final int RENDERING_MODE_STRETCH
        When using the RENDERING_MODE_STRETCH rendering mode video frames are stretched horizontally or vertically to match the current aspect ratio of the video editor.
        See Also:
        Constant Field Values
      • RENDERING_MODE_CROPPING

        public static final int RENDERING_MODE_CROPPING
        When using the RENDERING_MODE_CROPPING rendering mode video frames are scaled horizontally or vertically by preserving the original aspect ratio of the media item.
        See Also:
        Constant Field Values
      • mFilename

        protected final String mFilename
        The name of the file associated with the MediaItem
      • mBeginTransition

        protected Transition mBeginTransition
        Beginning and end transitions
      • mEndTransition

        protected Transition mEndTransition
      • mGeneratedImageClip

        protected String mGeneratedImageClip
      • mRegenerateClip

        protected boolean mRegenerateClip
    • Constructor Detail

      • MediaItem

        protected MediaItem(VideoEditor editor,
                 String mediaItemId,
                 String filename,
                 int renderingMode)
                     throws IOException
        Constructor
        Parameters:
        editor - The video editor reference
        mediaItemId - The MediaItem id
        filename - name of the media file.
        renderingMode - The rendering mode
        Throws:
        IOException - if file is not found
        IllegalArgumentException - if a capability such as file format is not supported the exception object contains the unsupported capability
    • Method Detail

      • getId

        public String getId()
        Returns:
        The id of the media item
      • getFilename

        public String getFilename()
        Returns:
        The media source file name
      • setRenderingMode

        public void setRenderingMode(int renderingMode)
        If aspect ratio of the MediaItem is different from the aspect ratio of the editor then this API controls the rendering mode.
        Parameters:
        renderingMode - rendering mode. It is one of: RENDERING_MODE_BLACK_BORDER, RENDERING_MODE_STRETCH
      • getRenderingMode

        public int getRenderingMode()
        Returns:
        The rendering mode
      • getBeginTransition

        public Transition getBeginTransition()
        Returns:
        The begin transition
      • getEndTransition

        public Transition getEndTransition()
        Returns:
        The end transition
      • getTimelineDuration

        public abstract long getTimelineDuration()
        Returns:
        The timeline duration. This is the actual duration in the timeline (trimmed duration)
      • getDuration

        public abstract long getDuration()
        Returns:
        The is the full duration of the media item (not trimmed)
      • getFileType

        public abstract int getFileType()
        Returns:
        The source file type
      • getWidth

        public abstract int getWidth()
        Returns:
        Get the native width of the media item
      • getHeight

        public abstract int getHeight()
        Returns:
        Get the native height of the media item
      • getAspectRatio

        public abstract int getAspectRatio()
        Get aspect ratio of the source media item.
        Returns:
        the aspect ratio as described in MediaProperties. MediaProperties.ASPECT_RATIO_UNDEFINED if aspect ratio is not supported as in MediaProperties
      • addEffect

        public void addEffect(Effect effect)
        Add the specified effect to this media item. Note that certain types of effects cannot be applied to video and to image media items. For example in certain implementation a Ken Burns implementation cannot be applied to video media item. This method invalidates transition video clips if the effect overlaps with the beginning and/or the end transition.
        Parameters:
        effect - The effect to apply
        Throws:
        IllegalStateException - if a preview or an export is in progress
        IllegalArgumentException - if the effect start and/or duration are invalid or if the effect cannot be applied to this type of media item or if the effect id is not unique across all the Effects added.
      • removeEffect

        public Effect removeEffect(String effectId)
        Remove the effect with the specified id. This method invalidates a transition video clip if the effect overlaps with a transition.
        Parameters:
        effectId - The id of the effect to be removed
        Returns:
        The effect that was removed
        Throws:
        IllegalStateException - if a preview or an export is in progress
      • getEffect

        public Effect getEffect(String effectId)
        Find the effect with the specified id
        Parameters:
        effectId - The effect id
        Returns:
        The effect with the specified id (null if it does not exist)
      • getAllEffects

        public List<Effect> getAllEffects()
        Get the list of effects.
        Returns:
        the effects list. If no effects exist an empty list will be returned.
      • addOverlay

        public void addOverlay(Overlay overlay)
                        throws FileNotFoundException,
                               IOException
        Add an overlay to the storyboard. This method invalidates a transition video clip if the overlay overlaps with a transition.
        Parameters:
        overlay - The overlay to add
        Throws:
        IllegalStateException - if a preview or an export is in progress or if the overlay id is not unique across all the overlays added or if the bitmap is not specified or if the dimensions of the bitmap do not match the dimensions of the media item
        FileNotFoundException, - IOException if overlay could not be saved to project path
        FileNotFoundException
        IOException
      • removeOverlay

        public Overlay removeOverlay(String overlayId)
        Remove the overlay with the specified id. This method invalidates a transition video clip if the overlay overlaps with a transition.
        Parameters:
        overlayId - The id of the overlay to be removed
        Returns:
        The overlay that was removed
        Throws:
        IllegalStateException - if a preview or an export is in progress
      • getOverlay

        public Overlay getOverlay(String overlayId)
        Find the overlay with the specified id
        Parameters:
        overlayId - The overlay id
        Returns:
        The overlay with the specified id (null if it does not exist)
      • getAllOverlays

        public List<Overlay> getAllOverlays()
        Get the list of overlays associated with this media item Note that if any overlay source files are not accessible anymore, this method will still provide the full list of overlays.
        Returns:
        The list of overlays. If no overlays exist an empty list will be returned.
      • getThumbnail

        public abstract Bitmap getThumbnail(int width,
                          int height,
                          long timeMs)
                                     throws IOException
        Create a thumbnail at specified time in a video stream in Bitmap format
        Parameters:
        width - width of the thumbnail in pixels
        height - height of the thumbnail in pixels
        timeMs - The time in the source video file at which the thumbnail is requested (even if trimmed).
        Returns:
        The thumbnail as a Bitmap.
        Throws:
        IOException - if a file error occurs
        IllegalArgumentException - if time is out of video duration
      • getThumbnailList

        public abstract void getThumbnailList(int width,
                            int height,
                            long startMs,
                            long endMs,
                            int thumbnailCount,
                            int[] indices,
                            MediaItem.GetThumbnailListCallback callback)
                                       throws IOException
        Get the array of Bitmap thumbnails between start and end.
        Parameters:
        width - width of the thumbnail in pixels
        height - height of the thumbnail in pixels
        startMs - The start of time range in milliseconds
        endMs - The end of the time range in milliseconds
        thumbnailCount - The thumbnail count
        indices - The indices of the thumbnails wanted
        callback - The callback used to pass back the bitmaps
        Throws:
        IOException - if a file error occurs
      • getThumbnailList

        public Bitmap[] getThumbnailList(int width,
                                int height,
                                long startMs,
                                long endMs,
                                int thumbnailCount)
                                  throws IOException
        Throws:
        IOException
      • equals

        public boolean equals(Object object)
        Description copied from class: Object
        Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

        The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

        The general contract for the equals and Object.hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

        Overrides:
        equals in class Object
        Parameters:
        object - the object to compare this instance with.
        Returns:
        true if the specified object is equal to this Object; false otherwise.
        See Also:
        Object.hashCode()
      • hashCode

        public int hashCode()
        Description copied from class: Object
        Returns an integer hash code for this object. By contract, any two objects for which Object.equals(java.lang.Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

        Note that hash values must not change over time unless information used in equals comparisons also changes.

        See Writing a correct hashCode method if you intend implementing your own hashCode method.

        Overrides:
        hashCode in class Object
        Returns:
        this object's hash code.
        See Also:
        Object.equals(java.lang.Object)
      • isOverlapping

        protected boolean isOverlapping(long startTimeMs1,
                            long durationMs1,
                            long startTimeMs2,
                            long durationMs2)
        Check if two items overlap in time
        Parameters:
        startTimeMs1 - Item 1 start time
        durationMs1 - Item 1 duration
        startTimeMs2 - Item 2 start time
        durationMs2 - Item 2 end time
        Returns:
        true if the two items overlap
      • adjustTransitions

        protected void adjustTransitions()
        Adjust the duration transitions.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 162 / 158697671. Delta: 0.04654 с