File tree Expand file tree Collapse file tree
src/main/java/org/schabi/newpipe/player Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ dependencies {
183183/* * NewPipe libraries **/
184184 // You can use a local version by uncommenting a few lines in settings.gradle
185185 implementation ' com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
186- implementation ' com.github.TeamNewPipe:NewPipeExtractor:3a3ade20f48cf37526eb970a7df56ee2405125fc '
186+ implementation ' com.github.TeamNewPipe:NewPipeExtractor:636e27333b5dbd9bc3c54ef3a4c21a87e97253ee '
187187
188188/* * Checkstyle **/
189189 checkstyle " com.puppycrawl.tools:checkstyle:${ checkstyleVersion} "
Original file line number Diff line number Diff line change 9191import org .schabi .newpipe .extractor .MediaFormat ;
9292import org .schabi .newpipe .extractor .stream .StreamInfo ;
9393import org .schabi .newpipe .extractor .stream .StreamSegment ;
94+ import org .schabi .newpipe .extractor .stream .StreamType ;
9495import org .schabi .newpipe .extractor .stream .VideoStream ;
9596import org .schabi .newpipe .fragments .OnScrollBelowItemsListener ;
9697import org .schabi .newpipe .fragments .detail .VideoDetailFragment ;
@@ -1632,9 +1633,22 @@ private void triggerProgressUpdate() {
16321633 if (exoPlayerIsNull ()) {
16331634 return ;
16341635 }
1636+ // Use duration of currentItem for non-live streams,
1637+ // because HLS streams are fragmented
1638+ // and thus the whole duration is not available to the player
1639+ // TODO: revert #6307 when introducing proper HLS support
1640+ final int duration ;
1641+ if (currentItem != null
1642+ && currentItem .getStreamType () != StreamType .AUDIO_LIVE_STREAM
1643+ && currentItem .getStreamType () != StreamType .LIVE_STREAM ) {
1644+ // convert seconds to milliseconds
1645+ duration = (int ) (currentItem .getDuration () * 1000 );
1646+ } else {
1647+ duration = (int ) simpleExoPlayer .getDuration ();
1648+ }
16351649 onUpdateProgress (
16361650 Math .max ((int ) simpleExoPlayer .getCurrentPosition (), 0 ),
1637- ( int ) simpleExoPlayer . getDuration () ,
1651+ duration ,
16381652 simpleExoPlayer .getBufferedPercentage ()
16391653 );
16401654 }
You can’t perform that action at this time.
0 commit comments