Last Updated On 2021-07-16
Version 7MinSDK 7Tutorial Video
A multimedia component capable of playing videos. When the application is run, the VideoPlayer will be displayed as a rectangle on-screen. If the user touches the rectangle, controls will appear to play/pause, skip ahead, and skip backward within the video. The application can also control behavior by calling the
Video files should be in 3GPP (.3gp) or MPEG-4 (.mp4) formats. For more details about legal formats, see Android Supported Media Formats.
App Inventor for Android only permits video files under 1 MB and limits the total size of an application to 5 MB, not all of which is available for media (video, audio, and sound) files. If your media files are too large, you may get errors when packaging or installing your application, in which case you should reduce the number of media files or their sizes. Most video editing software, such as Windows Movie Maker and Apple iMovie, can help you decrease the size of videos by shortening them or re-encoding the video into a more compact format.
You can also set the media source to a URL that points to a streaming video, but the URL must point to the video file itself, not to a program that plays the video.
You can set the below properties in the UI part of the builder.
- HeihMargin - it's a four value which is set to 0,0,0,0 by default.
- HeihPadding - it's a four value which is set to 0,0,0,0 by default.
- MarginBottom - it's a non negative float value which is set to 0 by default.
- MarginLeft - it's a non negative float value which is set to 0 by default.
- MarginRight - it's a non negative float value which is set to 0 by default.
- MarginTop - it's a non negative float value which is set to 0 by default.
- PaddingBottom - it's a non negative float value which is set to 0 by default.
- PaddingLeft - it's a non negative float value which is set to 0 by default.
- PaddingRight - it's a non negative float value which is set to 0 by default.
- PaddingTop - it's a non negative float value which is set to 0 by default.
- Source - it's a asset value which is set to blank by default.
- Visible - it's a visibility value which is set to true by default.
- Volume - it's a non negative float value which is set to 50 by default.
You can set the below blocks properties in the blocks section of the builder.
Returns whether the VideoPlayer's video is currently being shown in fullscreen mode or not.
Specifies the component's vertical height, measured in pixels.
Specifies the vertical height of the VideoPlayer as a percentage of the height of the Screen.
Property for MarginBottom
Property for MarginLeft
Property for MarginRight
Property for MarginTop
Property for PaddingBottom
Property for PaddingLeft
Property for PaddingRight
Property for PaddingTop
The "path" to the video. Usually, this will be the name of the video file, which should be added in the Designer.
Specifies whether the VideoPlayer should be visible on the screen. Value is true if the VideoPlayer is showing and false if hidden.
Sets the volume to a number between 0 and 100. Values less than 0 will be treated as 0, and values greater than 100 will be treated as 100.
Specifies the component's horizontal width, measured in pixels.
Specifies the horizontal width of the VideoPlayer as a percentage of the width of the Screen.
You can set the below method blocks in the blocks section of the builder.
Returns duration of the video in milliseconds.
Pauses playback of the video. Playback can be resumed at the same location by calling the
Seeks to the requested time (specified in milliseconds) in the video. If the video is paused, the frame shown will not be updated by the seek. The player can jump only to key frames in the video, so seeking to times that differ by short intervals may not actually move to different frames.
Starts playback of the video.
Resets to start of video and pauses it if video was playing.
You can set the below event blocks in the blocks section of the builder.
Indicates that the video has reached the end
The VideoPlayerError event is no longer used. Please use the Screen.ErrorOccurred event instead.