Skip to navigation

Play uploaded videos

Learn how to play FastPix videos and direct URLs using the FastPix Android Player SDK.

Play a FastPix video with a playback ID

Use setFastPixMediaItem when you have a playbackId from the FastPix dashboard. The SDK resolves the playback URL automatically (https://stream.fastpix.com/{playbackId}.m3u8).

private fun startPlayback() {
player?.setFastPixMediaItem {
playbackId = "YOUR_PLAYBACK_ID" // required
}
}

Note: streamType defaults to on-demand. Set it to live-stream for a live stream.

Play a direct URL

Use setMediaItem when you already have a playback URL (HLS .m3u8, DASH, progressive MP4, or other supported format):

player?.setMediaItem(MediaItem.fromUri("https://example.com/video.m3u8"))

Start playback in your Activity

Call the playback setup method from onStart to begin streaming:

override fun onStart() {
super.onStart()
startPlayback()
}
private fun startPlayback() {
playbackListener = object : PlaybackListener {
override fun onPlay() {}
override fun onPause() {}
override fun onPlaybackStateChanged(isPlaying: Boolean) {}
override fun onError(error: PlaybackException) {}
}
player?.addPlaybackListener(playbackListener)
player?.setFastPixMediaItem {
playbackId = "YOUR_PLAYBACK_ID"
}
}

Frequently asked questions

How do I play a FastPix video by playback ID?

Call setFastPixMediaItem and pass the playbackId you copied from the FastPix dashboard. The SDK resolves the playback URL automatically (https://stream.fastpix.com/{playbackId}.m3u8).

Can I play a direct HLS or MP4 URL?

Yes. Use setMediaItem(MediaItem.fromUri(url)) for a playback URL you already have, including HLS .m3u8, DASH, and progressive MP4 or other supported formats.

What is the difference between setFastPixMediaItem and setMediaItem?

setFastPixMediaItem builds a FastPix stream from a playbackId with options like resolution, token, and stream type. setMediaItem plays a direct URL you supply, with no FastPix resolution.

How do I play a live stream?

streamType defaults to on-demand. Set it to live-stream in the setFastPixMediaItem builder to play live content.

What’s next