-Enabled play queue control in main video player.

-Fixed video players does not resolve to preferred quality on playlists.
-Refactored resolution conversion to Localization.
-Fixed video player quality menu building exception when stream info is not yet available.
This commit is contained in:
John Zhen M 2017-10-12 20:47:12 -07:00 committed by John Zhen Mo
parent 87fca5cffe
commit b597774bb9
6 changed files with 223 additions and 17 deletions

View file

@ -6,6 +6,7 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.support.annotation.PluralsRes;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import org.schabi.newpipe.R;
@ -151,4 +152,13 @@ public class Localization {
}
return output;
}
public static int resolutionOf(final String resolution) {
final String[] candidates = TextUtils.split(resolution, "p");
if (candidates.length > 0 && TextUtils.isDigitsOnly(candidates[0])) {
return Integer.parseInt(candidates[0]);
} else {
return Integer.MAX_VALUE;
}
}
}