From fc8160acda333229e8b49f05c79ddff591162544 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 12 Feb 2016 15:29:11 +0100 Subject: [PATCH] fixed autoplay bug --- app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java | 2 +- app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java | 2 +- .../crawler/services/youtube/YoutubeStreamExtractor.java | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java index ae632cfc7..823fb762c 100644 --- a/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java +++ b/app/src/main/java/org/schabi/newpipe/PlayVideoActivity.java @@ -130,7 +130,7 @@ public class PlayVideoActivity extends AppCompatActivity { public void onPrepared(MediaPlayer mp) { progressBar.setVisibility(View.GONE); videoView.seekTo(position); - if (position == 0) { + if (position <= 0) { videoView.start(); showUi(); } else { diff --git a/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java b/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java index 29bbf24cc..a6aa4a43e 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/VideoInfo.java @@ -111,7 +111,7 @@ public class VideoInfo extends AbstractVideoInfo { public VideoPreviewInfo next_video = null; public List related_videos = null; //in seconds. some metadata is not passed using a VideoInfo object! - public int start_position = -1; + public int start_position = 0; //todo: public int service_id = -1; public VideoInfo() {} diff --git a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java index 499a942fd..78047398d 100644 --- a/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/crawler/services/youtube/YoutubeStreamExtractor.java @@ -463,7 +463,6 @@ public class YoutubeStreamExtractor implements StreamExtractor { * @return the offset (in seconds), or 0 if no timestamp is found.*/ @Override public int getTimeStamp() throws ParsingException { - //todo: use video_info for getting timestamp String timeStamp; try { timeStamp = Parser.matchGroup1("((#|&|\\?)t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)", pageUrl); @@ -505,7 +504,7 @@ public class YoutubeStreamExtractor implements StreamExtractor { throw new ParsingException("Could not get timestamp.", e); } } else { - return -1; + return 0; } }