mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Video trimming behind feature flag.
This commit is contained in:
committed by
Greyson Parrelli
parent
7f867a6185
commit
40fd7ca332
@@ -54,6 +54,7 @@ public final class FeatureFlags {
|
||||
private static final String PINS_FOR_ALL = generateKey("pinsForAll");
|
||||
private static final String PINS_MEGAPHONE_KILL_SWITCH = generateKey("pinsMegaphoneKillSwitch");
|
||||
private static final String PROFILE_NAMES_MEGAPHONE_ENABLED = generateKey("profileNamesMegaphoneEnabled");
|
||||
private static final String VIDEO_TRIMMING = generateKey("videoTrimming");
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -61,6 +62,7 @@ public final class FeatureFlags {
|
||||
*/
|
||||
|
||||
private static final Set<String> REMOTE_CAPABLE = Sets.newHashSet(
|
||||
VIDEO_TRIMMING,
|
||||
PINS_FOR_ALL,
|
||||
PINS_MEGAPHONE_KILL_SWITCH,
|
||||
PROFILE_NAMES_MEGAPHONE_ENABLED
|
||||
@@ -84,6 +86,7 @@ public final class FeatureFlags {
|
||||
* more burden on the reader to ensure that the app experience remains consistent.
|
||||
*/
|
||||
private static final Set<String> HOT_SWAPPABLE = Sets.newHashSet(
|
||||
VIDEO_TRIMMING,
|
||||
PINS_MEGAPHONE_KILL_SWITCH
|
||||
);
|
||||
|
||||
@@ -174,6 +177,11 @@ public final class FeatureFlags {
|
||||
TextSecurePreferences.getFirstInstallVersion(ApplicationDependencies.getApplication()) < 600;
|
||||
}
|
||||
|
||||
/** Allow trimming videos. */
|
||||
public static boolean videoTrimming() {
|
||||
return getValue(VIDEO_TRIMMING, false);
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Boolean> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
||||
@@ -300,7 +300,7 @@ public class MediaUtil {
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static @Nullable Bitmap getVideoThumbnail(Context context, Uri uri) {
|
||||
public static @Nullable Bitmap getVideoThumbnail(Context context, Uri uri, long timeUs) {
|
||||
if ("com.android.providers.media.documents".equals(uri.getAuthority())) {
|
||||
long videoId = Long.parseLong(uri.getLastPathSegment().split(":")[1]);
|
||||
|
||||
@@ -327,7 +327,7 @@ public class MediaUtil {
|
||||
MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
|
||||
|
||||
MediaMetadataRetrieverUtil.setDataSource(mediaMetadataRetriever, mediaDataSource);
|
||||
return mediaMetadataRetriever.getFrameAtTime(1000);
|
||||
return mediaMetadataRetriever.getFrameAtTime(timeUs);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "failed to get thumbnail for video blob uri: " + uri, e);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user