Merge pull request #6307 from TeamNewPipe/peertube_hls
Add support for PeerTube HLS streams
This commit is contained in:
commit
f0bb2e8687
|
@ -183,7 +183,7 @@ dependencies {
|
|||
/** NewPipe libraries **/
|
||||
// You can use a local version by uncommenting a few lines in settings.gradle
|
||||
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:3a3ade20f48cf37526eb970a7df56ee2405125fc'
|
||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:636e27333b5dbd9bc3c54ef3a4c21a87e97253ee'
|
||||
|
||||
/** Checkstyle **/
|
||||
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
||||
|
|
|
@ -91,6 +91,7 @@ import org.schabi.newpipe.databinding.PlayerPopupCloseOverlayBinding;
|
|||
import org.schabi.newpipe.extractor.MediaFormat;
|
||||
import org.schabi.newpipe.extractor.stream.StreamInfo;
|
||||
import org.schabi.newpipe.extractor.stream.StreamSegment;
|
||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||
import org.schabi.newpipe.extractor.stream.VideoStream;
|
||||
import org.schabi.newpipe.fragments.OnScrollBelowItemsListener;
|
||||
import org.schabi.newpipe.fragments.detail.VideoDetailFragment;
|
||||
|
@ -1632,9 +1633,22 @@ public final class Player implements
|
|||
if (exoPlayerIsNull()) {
|
||||
return;
|
||||
}
|
||||
// Use duration of currentItem for non-live streams,
|
||||
// because HLS streams are fragmented
|
||||
// and thus the whole duration is not available to the player
|
||||
// TODO: revert #6307 when introducing proper HLS support
|
||||
final int duration;
|
||||
if (currentItem != null
|
||||
&& currentItem.getStreamType() != StreamType.AUDIO_LIVE_STREAM
|
||||
&& currentItem.getStreamType() != StreamType.LIVE_STREAM) {
|
||||
// convert seconds to milliseconds
|
||||
duration = (int) (currentItem.getDuration() * 1000);
|
||||
} else {
|
||||
duration = (int) simpleExoPlayer.getDuration();
|
||||
}
|
||||
onUpdateProgress(
|
||||
Math.max((int) simpleExoPlayer.getCurrentPosition(), 0),
|
||||
(int) simpleExoPlayer.getDuration(),
|
||||
duration,
|
||||
simpleExoPlayer.getBufferedPercentage()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue