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).

1private fun startPlayback() {
2 player?.setFastPixMediaItem {
3 playbackId = "YOUR_PLAYBACK_ID" // required
4 }
5}

Note: StreamType is included in the builder for API compatibility but is not yet applied to the resolved URL in this SDK version.

Play a direct URL

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

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

Start playback in your Activity

Call the playback setup method from onStart to begin streaming:

1override fun onStart() {
2 super.onStart()
3 startPlayback()
4}
5
6private fun startPlayback() {
7 playbackListener = object : PlaybackListener {
8 override fun onPlay() {}
9 override fun onPause() {}
10 override fun onPlaybackStateChanged(isPlaying: Boolean) {}
11 override fun onError(error: PlaybackException) {}
12 }
13 player?.addPlaybackListener(playbackListener)
14
15 player?.setFastPixMediaItem {
16 playbackId = "YOUR_PLAYBACK_ID"
17 }
18}

What’s next