Class M3uStreamSegmentUrlProvider
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.source.stream.M3uStreamSegmentUrlProvider
-
- Direct Known Subclasses:
BeamSegmentUrlProvider,HlsStreamSegmentUrlProvider,TwitchStreamSegmentUrlProvider
public abstract class M3uStreamSegmentUrlProvider extends java.lang.ObjectProvides track segment URLs for streams which use the M3U segment format. There is a base M3U containing the list of different available streams. Those point to segment M3U urls, which always give the direct stream URLs of last X segments. The segment provider fetches the stream for the next segment on each call togetNextSegmentStream(com.sedmelluq.discord.lavaplayer.tools.io.HttpInterface).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classM3uStreamSegmentUrlProvider.ChannelStreamInfoprotected static classM3uStreamSegmentUrlProvider.SegmentInfo
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbaseUrlprotected M3uStreamSegmentUrlProvider.SegmentInfolastSegment
-
Constructor Summary
Constructors Modifier Constructor Description protectedM3uStreamSegmentUrlProvider()protectedM3uStreamSegmentUrlProvider(java.lang.String originUrl)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected M3uStreamSegmentUrlProvider.SegmentInfochooseNextSegment(java.util.List<M3uStreamSegmentUrlProvider.SegmentInfo> segments, M3uStreamSegmentUrlProvider.SegmentInfo lastSegment)protected abstract org.apache.http.client.methods.HttpUriRequestcreateSegmentGetRequest(java.lang.String url)protected static java.lang.StringcreateSegmentUrl(java.lang.String playlistUrl, java.lang.String segmentName)protected abstract java.lang.StringfetchSegmentPlaylistUrl(HttpInterface httpInterface)protected java.lang.StringgetAbsoluteUrl(java.lang.String url)java.io.InputStreamgetNextSegmentStream(HttpInterface httpInterface)Fetches the input stream for the next segment in the M3U stream.protected java.lang.StringgetNextSegmentUrl(HttpInterface httpInterface)Logic for getting the URL for the next segment.protected abstract java.lang.StringgetQualityFromM3uDirective(ExtendedM3uParser.Line directiveLine)If applicable, extracts the quality information from the M3U directive which describes one stream in the root M3U.protected booleanisAbsoluteUrl(java.lang.String url)protected java.util.List<M3uStreamSegmentUrlProvider.ChannelStreamInfo>loadChannelStreamsList(java.lang.String[] lines)protected java.util.List<M3uStreamSegmentUrlProvider.SegmentInfo>loadStreamSegmentsList(HttpInterface httpInterface, java.lang.String streamSegmentPlaylistUrl)
-
-
-
Field Detail
-
baseUrl
protected java.lang.String baseUrl
-
lastSegment
protected M3uStreamSegmentUrlProvider.SegmentInfo lastSegment
-
-
Method Detail
-
createSegmentUrl
protected static java.lang.String createSegmentUrl(java.lang.String playlistUrl, java.lang.String segmentName)
-
getQualityFromM3uDirective
protected abstract java.lang.String getQualityFromM3uDirective(ExtendedM3uParser.Line directiveLine)
If applicable, extracts the quality information from the M3U directive which describes one stream in the root M3U.- Parameters:
directiveLine- Directive line with arguments.- Returns:
- The quality name extracted from the directive line.
-
fetchSegmentPlaylistUrl
protected abstract java.lang.String fetchSegmentPlaylistUrl(HttpInterface httpInterface) throws java.io.IOException
- Throws:
java.io.IOException
-
getNextSegmentUrl
protected java.lang.String getNextSegmentUrl(HttpInterface httpInterface)
Logic for getting the URL for the next segment.- Parameters:
httpInterface- HTTP interface to use for any requests required to perform to find the segment URL.- Returns:
- The direct stream URL of the next segment.
-
getNextSegmentStream
public java.io.InputStream getNextSegmentStream(HttpInterface httpInterface)
Fetches the input stream for the next segment in the M3U stream.- Parameters:
httpInterface- HTTP interface to use for any requests required to perform to find the segment URL.- Returns:
- Input stream of the next segment.
-
createSegmentGetRequest
protected abstract org.apache.http.client.methods.HttpUriRequest createSegmentGetRequest(java.lang.String url)
-
isAbsoluteUrl
protected boolean isAbsoluteUrl(java.lang.String url)
-
getAbsoluteUrl
protected java.lang.String getAbsoluteUrl(java.lang.String url)
-
loadChannelStreamsList
protected java.util.List<M3uStreamSegmentUrlProvider.ChannelStreamInfo> loadChannelStreamsList(java.lang.String[] lines)
-
loadStreamSegmentsList
protected java.util.List<M3uStreamSegmentUrlProvider.SegmentInfo> loadStreamSegmentsList(HttpInterface httpInterface, java.lang.String streamSegmentPlaylistUrl) throws java.io.IOException
- Throws:
java.io.IOException
-
chooseNextSegment
protected M3uStreamSegmentUrlProvider.SegmentInfo chooseNextSegment(java.util.List<M3uStreamSegmentUrlProvider.SegmentInfo> segments, M3uStreamSegmentUrlProvider.SegmentInfo lastSegment)
-
-