kopia lustrzana https://github.com/TeamNewPipe/NewPipe
Move media tunneling setting to ExoPlayer settings and make this setting available on release builds
Media tunneling may be not supported by more devices than the ones we whitelisted before. As a matter of fact, the list of devices on which media tunneling is disabled could be not maintainable in the future, especially if the list of devices grows more and more. A preferable solution is to allow users to configure this setting themselves, allowing them to not wait for their device(s) to be whitelisted in a future NewPipe update. This solution has been applied in this commit and works on every build type. The corresponding preference in the debug settings has been of course removed and the code used to prevent media tunneling activation on specific devices has been removed.pull/8875/head
rodzic
41da8fc05f
commit
a6ff85a208
|
@ -77,7 +77,6 @@ import com.google.android.exoplayer2.text.CueGroup;
|
|||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
|
||||
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
import com.google.android.exoplayer2.video.VideoSize;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.squareup.picasso.Target;
|
||||
|
@ -115,7 +114,6 @@ import org.schabi.newpipe.player.ui.PlayerUiList;
|
|||
import org.schabi.newpipe.player.ui.PopupPlayerUi;
|
||||
import org.schabi.newpipe.player.ui.VideoPlayerUi;
|
||||
import org.schabi.newpipe.util.DependentPreferenceHelper;
|
||||
import org.schabi.newpipe.util.DeviceUtils;
|
||||
import org.schabi.newpipe.util.ListHelper;
|
||||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.PicassoHelper;
|
||||
|
@ -522,16 +520,11 @@ public final class Player implements PlaybackListener, Listener {
|
|||
// Setup UIs
|
||||
UIs.call(PlayerUi::initPlayer);
|
||||
|
||||
// enable media tunneling
|
||||
if (DEBUG && PreferenceManager.getDefaultSharedPreferences(context)
|
||||
// Disable media tunneling if requested by the user from ExoPlayer settings
|
||||
if (!PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(context.getString(R.string.disable_media_tunneling_key), false)) {
|
||||
Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] "
|
||||
+ "media tunneling disabled in debug preferences");
|
||||
} else if (DeviceUtils.shouldSupportMediaTunneling()) {
|
||||
trackSelector.setParameters(trackSelector.buildUponParameters()
|
||||
.setTunnelingEnabled(true));
|
||||
} else if (DEBUG) {
|
||||
Log.d(TAG, "[" + Util.DEVICE_DEBUG_INFO + "] does not support media tunneling");
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
|
|
@ -36,22 +36,6 @@ public final class DeviceUtils {
|
|||
private static Boolean isTV = null;
|
||||
private static Boolean isFireTV = null;
|
||||
|
||||
/*
|
||||
* Devices that do not support media tunneling
|
||||
*/
|
||||
// Formuler Z8 Pro, Z8, CC, Z Alpha, Z+ Neo
|
||||
private static final boolean HI3798MV200 = Build.VERSION.SDK_INT == 24
|
||||
&& Build.DEVICE.equals("Hi3798MV200");
|
||||
// Zephir TS43UHD-2
|
||||
private static final boolean CVT_MT5886_EU_1G = Build.VERSION.SDK_INT == 24
|
||||
&& Build.DEVICE.equals("cvt_mt5886_eu_1g");
|
||||
// Hilife TV
|
||||
private static final boolean REALTEKATV = Build.VERSION.SDK_INT == 25
|
||||
&& Build.DEVICE.equals("RealtekATV");
|
||||
// Philips QM16XE
|
||||
private static final boolean QM16XE_U = Build.VERSION.SDK_INT == 23
|
||||
&& Build.DEVICE.equals("QM16XE_U");
|
||||
|
||||
private DeviceUtils() {
|
||||
}
|
||||
|
||||
|
@ -211,18 +195,6 @@ public final class DeviceUtils {
|
|||
context.getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
/**
|
||||
* Some devices have broken tunneled video playback but claim to support it.
|
||||
* See https://github.com/TeamNewPipe/NewPipe/issues/5911
|
||||
* @return false if affected device
|
||||
*/
|
||||
public static boolean shouldSupportMediaTunneling() {
|
||||
return !HI3798MV200
|
||||
&& !CVT_MT5886_EU_1G
|
||||
&& !REALTEKATV
|
||||
&& !QM16XE_U;
|
||||
}
|
||||
|
||||
public static boolean isLandscape(final Context context) {
|
||||
return context.getResources().getDisplayMetrics().heightPixels < context.getResources()
|
||||
.getDisplayMetrics().widthPixels;
|
||||
|
|
|
@ -227,7 +227,6 @@
|
|||
<string name="show_memory_leaks_key">show_memory_leaks_key</string>
|
||||
<string name="allow_disposed_exceptions_key">allow_disposed_exceptions_key</string>
|
||||
<string name="show_original_time_ago_key">show_original_time_ago_key</string>
|
||||
<string name="disable_media_tunneling_key">disable_media_tunneling_key</string>
|
||||
<string name="show_image_indicators_key">show_image_indicators_key</string>
|
||||
<string name="show_crash_the_player_key">show_crash_the_player_key</string>
|
||||
<string name="check_new_streams_key">check_new_streams</string>
|
||||
|
@ -1369,5 +1368,6 @@
|
|||
|
||||
<!-- ExoPlayer settings -->
|
||||
<string name="exoplayer_settings_key">exoplayer_settings_key</string>
|
||||
<string name="disable_media_tunneling_key">disable_media_tunneling_key</string>
|
||||
<string name="use_exoplayer_decoder_fallback_key">use_exoplayer_decoder_fallback_key</string>
|
||||
</resources>
|
||||
|
|
|
@ -34,14 +34,6 @@
|
|||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/disable_media_tunneling_key"
|
||||
android:summary="@string/disable_media_tunneling_summary"
|
||||
android:title="@string/disable_media_tunneling_title"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/show_image_indicators_key"
|
||||
|
|
|
@ -21,4 +21,12 @@
|
|||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/disable_media_tunneling_key"
|
||||
android:summary="@string/disable_media_tunneling_summary"
|
||||
android:title="@string/disable_media_tunneling_title"
|
||||
app:singleLineTitle="false"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
</PreferenceScreen>
|
Ładowanie…
Reference in New Issue