Play videos from local files or URLs in an HVArrangement or Dialog.
I'm using the VideoView class.
Playback capacity depends primarily on available memory, device resources, and the complexity of the video (resolution, format, etc.). Longer videos tend to consume more resources, which can lead to issues such as stuttering or freezing if the device isn't optimized to handle such loads.
Formats I have tried and that work:
.mp4 | .mov | .3gp | .3g2 | .mkv | .webm
SetVideoPath
Set the video url or file path from the device.
Supported formats:
.mp4 | .mov | .3gp | .3g2 | .mkv | .webm
AttachToArrangement
Set the Arrangement where you want to play the video.
ShowVideoInDialog
Play the video in a dialog.
It fully expands in width and height proportionally whether it is started in a screen position or rotated.
If the video is playing, it will not pause or restart when you rotate the screen, the video will continue to play.
Everything around the dialogue is darkened to provide better focus on the video.
StartVideo
If the video is paused, calling StartVideo will resume it from where it was paused.
PauseVideo
StopVideo
Stop playing video.
The video will stop and the VideoView will close.
If it's the Dialog, it will also close the dialog.
ResetVideoView
Resets the VideoView for reuse in a new container.
SeekTo
Seeks to a specific position in the video.
FormatHoursMinutesSeconds
Convert milliseconds to a formatted HH:mm:ss.
IsPlaying
Returns true if the video is currently playing, false otherwise.
Duration
Gets the total duration of the video in milliseconds.
CurrentPosition
Gets the current position of the video in milliseconds.
CancelOnTouchOutside
Sets whether the dialog can be dismissed by touching outside of it.
VideoPlay
Triggered when the video starts playing.
VideoPause
Triggered when the video has been paused.
VideoStop
Triggered when the video has been stopped.
VideoCompleted
Triggered when the video playback is completed.
VideoValueChanged
Triggered continuously while the video is playing, providing the current position.
Update v1.1
-
Fixed an issue that caused the app to crash when playing a video in an arrangement and then opening it in a dialog.
-
Setting the
CancelOnTouchOutside
property totrue
prevents the dialog box from closing and now also prevents the back button on the device's navigation bar from being used.
(To exit the video, you'll need to close the app with the other buttons).
aiaProject v1.1
VideoPlayer.aia (29.1 KB)
Extension v1.1
joejsanz.joedevvideoplayer.aix (15.9 KB)
JDK: 11
Minimum API Level: 21
Updated On: 2025-03-25T07:00:00Z
Built using: FAST-CLI v2.8.0
Thanks.