3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android ExoplayerでBASIC認証付きURLを再生

Posted at

自分向けの備忘録
ManifestFetcherの引数UriDataSourceに対してBASIC認証ヘッダを付加したHttpDataSourceを渡すことで
BASIC認証付きのファイルの再生ができました

private final ManifestFetcher<HlsPlaylist> playlistFetcher;

.......

HlsPlaylistParser parser = new HlsPlaylistParser();
HttpDataSource defaultHttpDataSource = new DefaultHttpDataSource(userAgent, null);

//BASIC認証をHttpDataSourceに追加
String credential = com.squareup.okhttp.Credentials.basic(BuildConfig.USERNAME, BuildConfig.PASSWORD);
defaultHttpDataSource.setRequestProperty("Authorization",credential);

//マニフェストにBASIC認証ヘッダを追加したHttpDataSourcew渡す
playlistFetcher = new ManifestFetcher<>(url, defaultHttpDataSource,parser);

com.google.android.exoplayer.r1.5.9

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?