androidx / androidx/media

How to switch between hls and progressive factory in playlist

Open
#374 8 comments 0 reactions 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since May 2, 2023.

question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Hi. I am getting lists of urls for audio streams, and some of them are hls.
So I am using this logic, which is suitable for playing separate streams:


val mediaSource = if(lastPath?.contains("m3u8") == true ||
lastPath?.contains("m3u") == true) {

HlsMediaSource.Factory(dataSourceFactory)
setAllowChunklessPreparation(true)
.createMediaSource(mediaItem)
        } else {

ProgressiveMediaSource.Factory(dataSourceFactory)
 .setContinueLoadingCheckIntervalBytes(checkInterval)
.createMediaSource(mediaItem)
        }

To play next/prev stream from notification/lock screen I need to pass list of mediaitems or concatenating mediasource to the player, and I don't see how I can switch between those two factories then.
Maybe with DefaultMediaSourceFactory, but ideally I would like to keep setContinueLoadingCheckIntervalBytes setting.
Is it possible, or should I look into custom actions of notification (i am using PlayerNotificationManager)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.