mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-04-28 17:00:27 -05:00
pip mode decrease resolution
This commit is contained in:
+1
@@ -25,4 +25,5 @@ public interface PlaybackEngineController {
|
||||
boolean isEngineBlocked();
|
||||
void enablePIP(boolean enable);
|
||||
boolean isPIPEnabled();
|
||||
boolean isInPIPMode();
|
||||
}
|
||||
|
||||
+8
-4
@@ -42,8 +42,10 @@ public class StateUpdater extends PlayerEventListenerHelper {
|
||||
mIsPlaying = true; // video just added
|
||||
|
||||
// Ensure that we aren't running on presenter init stage
|
||||
if (mController != null) {
|
||||
saveState(); // save state of previous item
|
||||
if (mController != null && mController.isEngineBlocked()) {
|
||||
// In background mode some event not called.
|
||||
// So, for proper state persistence, we need to save state here.
|
||||
saveState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +107,7 @@ public class StateUpdater extends PlayerEventListenerHelper {
|
||||
|
||||
@Override
|
||||
public void onTrackClicked(FormatItem track) {
|
||||
if (track.getType() == FormatItem.TYPE_VIDEO) {
|
||||
if (track.getType() == FormatItem.TYPE_VIDEO && !mController.isInPIPMode()) {
|
||||
mVideoFormat = track;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +136,9 @@ public class StateUpdater extends PlayerEventListenerHelper {
|
||||
}
|
||||
|
||||
private void restoreState(Video item) {
|
||||
if (mVideoFormat != null) {
|
||||
if (mController.isInPIPMode()) {
|
||||
mController.selectFormat(FormatItem.SD_AVC);
|
||||
} else if (mVideoFormat != null) {
|
||||
mController.selectFormat(mVideoFormat);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -5,6 +5,8 @@ import com.liskovsoft.smartyoutubetv2.common.exoplayer.selector.ExoFormatItem;
|
||||
public interface FormatItem {
|
||||
FormatItem FHD_AVC = ExoFormatItem.defaultVideo(ExoFormatItem.RESOLUTION_FHD, ExoFormatItem.FORMAT_AVC, ExoFormatItem.FPS_30);
|
||||
FormatItem HD_AVC = ExoFormatItem.defaultVideo(ExoFormatItem.RESOLUTION_HD, ExoFormatItem.FORMAT_AVC, ExoFormatItem.FPS_30);
|
||||
FormatItem SD_AVC = ExoFormatItem.defaultVideo(ExoFormatItem.RESOLUTION_SD, ExoFormatItem.FORMAT_AVC, ExoFormatItem.FPS_30);
|
||||
FormatItem LD_AVC = ExoFormatItem.defaultVideo(ExoFormatItem.RESOLUTION_LD, ExoFormatItem.FORMAT_AVC, ExoFormatItem.FPS_30);
|
||||
int TYPE_VIDEO = 0;
|
||||
int TYPE_AUDIO = 1;
|
||||
int TYPE_SUBTITLE = 2;
|
||||
|
||||
+12
-2
@@ -10,8 +10,10 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ExoFormatItem implements FormatItem {
|
||||
public static final int RESOLUTION_FHD = 0;
|
||||
public static final int RESOLUTION_HD = 1;
|
||||
public static final int RESOLUTION_FHD = 3;
|
||||
public static final int RESOLUTION_HD = 2;
|
||||
public static final int RESOLUTION_SD = 1;
|
||||
public static final int RESOLUTION_LD = 0;
|
||||
public static final int FORMAT_AVC = 0;
|
||||
public static final int FPS_30 = 0;
|
||||
private int mType;
|
||||
@@ -113,6 +115,14 @@ public class ExoFormatItem implements FormatItem {
|
||||
width = 1280;
|
||||
height = 720;
|
||||
break;
|
||||
case RESOLUTION_SD:
|
||||
width = 640;
|
||||
height = 360;
|
||||
break;
|
||||
case RESOLUTION_LD:
|
||||
width = 426;
|
||||
height = 240;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
|
||||
Reference in New Issue
Block a user