fixed autoplay bug

This commit is contained in:
Christian Schabesberger 2016-02-12 15:29:11 +01:00
parent 751ffb9de9
commit fc8160acda
3 changed files with 3 additions and 4 deletions

View File

@ -130,7 +130,7 @@ public class PlayVideoActivity extends AppCompatActivity {
public void onPrepared(MediaPlayer mp) { public void onPrepared(MediaPlayer mp) {
progressBar.setVisibility(View.GONE); progressBar.setVisibility(View.GONE);
videoView.seekTo(position); videoView.seekTo(position);
if (position == 0) { if (position <= 0) {
videoView.start(); videoView.start();
showUi(); showUi();
} else { } else {

View File

@ -111,7 +111,7 @@ public class VideoInfo extends AbstractVideoInfo {
public VideoPreviewInfo next_video = null; public VideoPreviewInfo next_video = null;
public List<VideoPreviewInfo> related_videos = null; public List<VideoPreviewInfo> related_videos = null;
//in seconds. some metadata is not passed using a VideoInfo object! //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; //todo: public int service_id = -1;
public VideoInfo() {} public VideoInfo() {}

View File

@ -463,7 +463,6 @@ public class YoutubeStreamExtractor implements StreamExtractor {
* @return the offset (in seconds), or 0 if no timestamp is found.*/ * @return the offset (in seconds), or 0 if no timestamp is found.*/
@Override @Override
public int getTimeStamp() throws ParsingException { public int getTimeStamp() throws ParsingException {
//todo: use video_info for getting timestamp
String timeStamp; String timeStamp;
try { try {
timeStamp = Parser.matchGroup1("((#|&|\\?)t=\\d{0,3}h?\\d{0,3}m?\\d{1,3}s?)", pageUrl); 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); throw new ParsingException("Could not get timestamp.", e);
} }
} else { } else {
return -1; return 0;
} }
} }