phuochau / react-native-thumbnail Goto Github PK
View Code? Open in Web Editor NEWGet thumbnail from local media. Currently, it only supports for video.
License: MIT License
Get thumbnail from local media. Currently, it only supports for video.
License: MIT License
Hi,
Environment:
OS: macOS High Sierra 10.13.6
Node: 8.10.0
Yarn: 1.5.1
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: 3.1 AI-173.4670197
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.54.4 => 0.54.4
I cannot install the library on Android, It throws the error 'Cannot resolve symbol 'reactlibrary'' and it does not recognize the package when adding the line 'import com.reactlibrary.RNThumbnailPackage;' in MainApplication.java (NOT IN MainActivity as it is i believe wrongly stated on the project page).
The package is installed with 'npm install react-native-thumbnail --save' and appears in package.json.
How to solve this ASAP?
Thank you
Mostly this happen that first frame of video doesn't depict the actual value and we might want allow user to select their own thumb. From video timestamp. Can we give a provision where user can pass a timestamp and call back create return path for frame of that particular timestamp.
I'd like to extract an image from a specific moment in the video. Possible?
getThumbnail(filePath){
let thumbnailURL;
RNThumbnail.get(filePath).then((response) => response.path)
.then((responseData) => {
console.warn(responseData);
return responseData;
})
.catch(error => console.warn(error));
alert(thumbnailURL);
//return thumbnailURL;
}
I am trying to get thumbnail path and storing to a variable to be used, But I am getting undefined
I am trying to video photo on react-native v0.60.x but does not work.
Please update this nice package with the latest version.
I got this error in android stuidio.
Gradle DSL method not found: 'google()'
Hey , The android package name for the library is ReactLibrary which comes by default, It might causes error during build if some new library is added (having the default name). Kindly change it
2019-09-15 00:56:03.426 6000-6000/com.testvideothumb E/Parcel: Reading a NULL string not supported here.
2019-09-15 00:56:03.442 6000-6079/com.testvideothumb E/unknown:ReactNative: Exception in native call
java.lang.IllegalArgumentException
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:110)
at me.hauvo.thumbnail.RNThumbnailModule.get(RNThumbnailModule.java:46)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:232)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:764)
I have tried many methods, still ineffective, tired
I am using react-native-document-picker. I get the file path using the res object, res.uri
give me file path in the form of content://com.android.providers.media.documents/document/video%xxxxxxx. On giving this file path to RNThumbnail.get(res.uri)
my app crashes. I don't know whether there is problem with uri
or anything else.
what's license?
I'm unable to render a thumbnail image with this library. It returns a result
with a path
for the cached thumbnail but the height
and width
properties are both 0
. Do these properties suggest that the image cannot be rendered? I am providing my own height
and width
style properties to the <Image />
itself.
Remove peerDependencies "react-native": "^0.47.0"
Sometimes the path is returned but the file has not finished writing to that location. That can result in a file not found error when trying to display.
Hi,
I am getting 'More than one library with package name 'com.reactlibrary'' error in android.
Can you please help me with this? it's conflicting to another package with the same name.
import com.reactlibrary.RNReactNativeDocViewerPackage;
...
import com.reactlibrary.RNThumbnailPackage;
Thank you.
I want to know the point at which the cache generated thumbnail got deleted. Will i have to handle it manually by myself or the deletion of those cache generated thumbnail is automated.. If Yes.. How?
Thanks in advance and best regards
New thumbnail is generating every time i run RNThumbnail.get(path), so how can i generate it only once? Sorry for my english)
Somewhere in the README we should add that you need storage permission to use this library for Android:
import Permissions from "react-native-permissions";
...
if(!isIos) await Permissions.request("storage");
I got the path, but the width and height were 0.
"react-native": "0.57.8"
"react-native-thumbnail": "^1.1.3"
can you fixe it?
I think that we don't need "@OverRide" for public List<Class<? extends JavaScriptModule>>
method, when I am trying run "react-native run-android" I have compile error:
/node_modules/react-native-thumbnail/android/src/main/java/com/reactlibrary/RNThumbnailPackage.java:19: error: method does not override or implement a method from a supertype
@Override
^
1 error
When I remove "@OverRide" this works and compile fine
I am not good in Java, but I think we can do it.
Line that I think we need to remove: https://github.com/phuochau/react-native-thumbnail/blob/master/android/src/main/java/com/reactlibrary/RNThumbnailPackage.java#L19
Most of the time the thumbnails are blurry. I'm taking the videos with react-native-camera like so:
const options = {
quality: RNCamera.Constants.VideoQuality["480p"],
mute: true
// maxDuration: 60 * 3
};
...
const data = await this.camera.recordAsync(options);
...
<RNCamera
ref={this.createRef}
style={styles.cameraStyles}
type={this.state.camera.type}
flashMode={this.state.camera.flashMode}
onFocusChanged={() => {}}
onZoomChanged={() => {}}
defaultTouchToFocus
mirrorImage={false}
/>
Any way to improve the thumbnail quality?
I am using version 7.1 on android and I get this error
Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
Error: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
The path am passing on it looks like this : file:///storage/emulated/0/Movies/VID_20170930_062218.mp4
any ideas?
`Execution failed for task ':react-native-thumbnail:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
G:\Users\ASUS\WebStormProjects\shootingv1\node_modules\react-native-thumbnail\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
G:\Users\ASUS\WebStormProjects\shootingv1\node_modules\react-native-thumbnail\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
G:\Users\ASUS\WebStormProjects\shootingv1\node_modules\react-native-thumbnail\android\build\intermediates\res\merged\release\values\values.xml:2713: error: resource android:attr/fontVariationSettings not found.
G:\Users\ASUS\WebStormProjects\shootingv1\node_modules\react-native-thumbnail\android\build\intermediates\res\merged\release\values\values.xml:2714: error: resource android:attr/ttcIndex not found.
error: failed linking references.`
My thumbnail is always the last frame on my video. How do I get the first frame for my video thumbnail?
I'm on android.
My video is only 3 secs long, and will always be like that, but I keep on getting the 2nd or 3rd sec frame.
I building on android, with this info:
Environment: OS: Windows 10 Node: 8.10.0 Yarn: 1.5.1 npm: 5.8.0 Watchman: Not Found Xcode: N/A Android Studio: Version 3.0.0.0 AI-171.4443003
Packages: (wanted => installed) react: 16.3.0-alpha.1 => 16.3.0-alpha.1 react-native: 0.54.3 => 0.54.3
,
Currently the thumbnail is generated from the start of the video. However it would be awesome if there was an option to specify the timestamp on which the thumbnail should be created via an option.
I could implement this for iOS.
The API could be designed like this:
import RNThumbnail from 'react-native-thumbnail';
const timestampInMilliseconds = 3000
RNThumbnail.get(filepath).then((result, { timestamp: timestampInMilliseconds }) => {
console.log(result.path); // thumbnail path
})
Hi, there.
I got the thumbnail as an image on Android version, but I didn't get it on iOS version well.
I got the path, but the width and height were 0.
What is wrong?
I am using RN 0.44.0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.