Add custom HTTP headers (Android v3)
Authorize your content request with HTTP headers.
If your content server allows for HTTP header authentication, you can apply HTTP headers to your self-hosted, registered content. HTTP headers prevent unauthorized downloads of your content.
To authorize your content request with HTTP headers, use the following steps:
- Create a
Map<String, String>object and name it, for example,httpHeaders. - Define httpHeaders.
- Add
httpHeadersto aPlaylistItem.
// Create a list to contain the PlaylistItems List<PlaylistItem> playlist = new ArrayList<>(); // Create key-value map for the HTTP headers Map<String, String> httpHeaders = new HashMap<>(); httpHeaders.put("cookie", "abcd1234"); // Add a PlaylistItem pointing to the first piece of content PlaylistItem content = new PlaylistItem.Builder() .file("http://content/http-header-protected-content.m3u8") .httpHeaders(httpHeaders) .build(); // Add the content to the playlist playlist.add(content);
Updated about 2 months ago
Did this page help you?
