expo ImagePicker doesn't pick animating gif in android - android

I am trying to select gif files using expo-image-picker. However, it doesn't select the gif file in android, it selects the first frame of the gif even when quality is set to undefined and allowsEditing to false.
Version of expo - 46.0.9, Version of expo-image-picker - 13.3.1. Here's a reproducible demo - snack demo
Expected behavior on android:
Actual behavior on android:

I had this issue myself and found a solution.
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
// allowsEditing: false,
// aspect: aspect,
quality: 1,
// exif: false
});

Related

Accessing android view in Nativescript

I'm trying to use a loader-plugin for nativescript and run into an error that says:
Error creating Loading Indicator Pop Over: Cannot read property 'drawable' of undefined
It seems that the error comes from using android.view.View in the options for the loader.
There's not much additional information about this error, but from my experience with mobile apps I'd say that this error occurs because the view hasn't loaded, yet.
I tried to apply a timeout, move the call around (from onNavigatingTo to onPageLoad), nothing helped.
Here's the code I'm using:
const options = {
message: "Daten werden geladen…",
details: "Bitte warten",
progress: 0.65,
margin: 10,
dimBackground: true,
color: "#fff", // color of indicator and labels
// background box around indicator
// hideBezel will override this if true
backgroundColor: "black",
userInteractionEnabled: false, // default true. Set false so that the touches will fall through it.
hideBezel: true, // default false, can hide the surrounding bezel
mode: Mode.AnnularDeterminate, // see options below
android: {
view: android.view.View, // Target view to show on top of (Defaults to entire window)
cancelable: true,
cancelListener: function (dialog) {
console.log("Loading cancelled");
}
},
ios: {
view: UIView, // Target view to show on top of (Defaults to entire window)
}
};
loader.show(options);
Nativescript 7.x using Javascript
Any ideas?
First of all, I don't like using platform-specific code like android.view.View or UIView without appropriate isIOS/isAndroid wrappers.
So I'd advise to use this.page.nativeView or this.page.getViewById('someIdHere').nativeView instead.
Adding zero milliseconds timeout is also a good practice. Just to be sure that page content is available.
Would be great if you could provide me some small example, so I could check on my side

How to have display buckets like android in react native?

I am planning to build a react native app.The app gets targetted to 3 main things.
1ft => Mobiles(IOS,ANDROID),
2ft => Tablets,
10ft => Android TV.
How can we create files so that if I want to build for 1ft(Mobiles),the app should take only 1ft files like
eg; 1ft_android.js,1ft_ios.js
eg; 2ft_android.js ,2ft_ios.js
and in the same how can I build separately without using Platform.Select Or is there any chance to use flavours and is there any way to make this happen?
Edit 1: I have the folder structure as follows:
I want to find a way to let react know that if display metric matches
1ft, take landing.1ft.android.js. I don't want to compare display
metrics everytime. I'm looking for some configuration so react will
pick the respective file like it picks platform specific files.
For Platform specific UI you can Switch using Platform module.
import {Platform, StyleSheet} from 'react-native';
const styles = StyleSheet.create({
height: Platform.OS === 'ios' ? 200 : 100,
});
But if you want to create responsive UI which will adjust its shape
and size with respect to screen you can use the following methods:
Flex: https://facebook.github.io/react-native/docs/height-and-width#flex-dimensions
Screen ratio:
var deviceWidth: Dimensions.get('window').width;
...
myImage { width: deviceWidth, height: deviceWidth * 0.5 }
And for font-size you can use this function:
export const getAdjustedFontSize = (size) => {
return parseInt(size) * metrics.screenWidth * (1.8 - 0.002 * metrics.screenWidth) / 400;
};
Edit:
You can refer to this link also: https://medium.com/react-native-training/build-responsive-react-native-views-for-any-device-and-support-orientation-change-1c8beba5bc23

How to open only default android camera in cordova

How to open only default android camera in cordova:
In my phone tow camera one is default camera and second is Beautify aap. I want to open only my default camera only by using cordova.
please use following plugin
cordova plugin add org.apache.cordova.camera
this function will open camera app,
$scope.takePicture = function (options) {
var options = {
quality : 75,
targetWidth: 200,
targetHeight: 200,
sourceType: 1
};
Camera.getPicture(options).then(function(imageData) {
$scope.picture = imageData;;
}, function(err) {
console.log(err);
});
};
if above function is opening Beautify camera app,then you have selected it as default camera app,please check in phone settings.
Clear defaults from Beautify camera app
For references:
Tutorial 1
Tutorial 2

ChromeCast SDK Album Art

Using the default ChromeCast RemoteMediaPlayer class and the default receiver, how do you add album art to the page? I have tried looking at http://developer.android.com/reference/com/google/android/gms/cast/MediaMetadata.html, but there does not appear to be a entry for album art. There is a bug place holder on the screen though, so I assume it is supported somehow. I looked at https://github.com/googlecast/Cast-Player-Sample/blob/master/player.js, and there appears to be a case where it tries to get the art work with ar artwork = sampleplayer.getValue_(event.data, ['media', 'metadata', 'images', 0, 'url']);, but I don't see any way to actually fill that out from the client side.
MediaMetadata hold reference to images and has an addImage method. That is where you have to keep the info about your images, including album art (you can add as many references as you want, possibly different aspect ratios, resolutions, etc)
In case you cannot make it work, you could use this javascript library:
https://github.com/fenny/castjs
var device = new Castjs();
device.on('available', () => {
device.cast('https://fenny.github.io/Castjs/demo/poster.jpg', {
poster: 'https://fenny.github.io/Castjs/demo/poster.jpg',
title: 'Sintel',
description: 'Third Open Movie by Blender Foundation',
subtitles: [{
active: true,
label: 'English',
source: 'https://fenny.github.io/Castjs/demo/english.vtt'
}, {
label: 'Spanish',
source: 'https://fenny.github.io/Castjs/demo/spanish.vtt'
}],
muted: false,
paused: false
})
});
});
Notice the "poster" value, good luck.

How to change Cordova camera plugin options

I am using cordova camera plugin. It works fine. But i have two problems. One of them; after i capture photo 2 buttons appear. Their names are "Save" and "Discard". I want to rename them with "confirm" and "Cancel". How can i do this? an other question; after Saving photo, my photo is turning. How can i block this?
Save/Discard - you can't do this in the Cordova Camera API presented to you.
You'd need to write your own plugin which uses a SurfaceView (more
detail here).
This is a known Android issue - it ignores the correctOrientation parameter - I believe however that it uploads the photo in the correct orientation. It just is not shown correctly.
after i add correctOrientation in my code, it shown phooto correctly.
navigator.camera.getPicture(photoCaptured,photoCapturedFail,
{
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
correctOrientation: true
});

Categories

Resources