Codename One - Share a video from a CN1 app to another app - codenameone

How can I share a video recorded with Codename One with the native OS sharing support? The ShareButton supports only text and images.

yo can use Display.getInstance().share(String text, String path, String type), where text is the string to share in your case video file, path is file path to your video file, type is type of the video(i.e mimetype).

Related

Convert video file to byte array and save within app

I am trying save some video in react native app privately. So that i can download videos within app and can watch within app after download. So i am not able to get it how can i do this. Let me know if anybody have resolution for this approach. i was checking that we can convert files into byte than can store within react native app. again then convert into video and can watch it within app. Let me know if this can be done by anyone. Thanks
<Video source={{uri: "background"}}
ref={(ref) => {
this.player = ref
}}
onBuffer={this.onBuffer}
onError={this.videoError}
style={styles.backgroundVideo} />
Watch this video
You can watch the above video. Anybody have a idea that how mx doing this thing. I want to do same. Download videos and save and will be private and play in my app.
For downloading any file like video,img ..
there are two best known libraries for downloading files
https://www.npmjs.com/package/react-native-fs
https://www.npmjs.com/package/react-native-fetch-blob
Now you can follow their documentation to download files like Videos,images or whatever you want to your user's phone.
For the part that you dont want it to be available to user via gallery.
For this you can use react-native-fetchblob as it has builtin intent actions and views. You can download a video file with any random name like 1234CACHE any random name without any extension to it, specially dont give it extension like video.mp4 because gallery detects .mp4 files so dont give it any extension and the file won't be available in any gallery.
Now how to hide the file? react-native-fetch-blob allow us to save files into directories that are not publicly available i mean user cannot reach those directory and these directories are used only for saving App's data so you can save your video file in one of these directories.
Now after completing your download, You can open your file with the Intent.
Example:
const VIDEO_PATH = res.path() //the path where your downloaded video is saved, you will actually receive this in the response of download function.
const MIME_TYPE = "video/mp4"
//Now finally call the intent with video mime so the video will be opened in user's media player, or if you want your own media player you can use any library for that.
android.actionViewIntent(VIDEO_PATH , MIME_TYPE)
you can use https://github.com/RonRadtke/react-native-blob-util to download any remote files

How can I open mp4 or other video files by native way on react native

I am developing a function that when clicking an mp4 video, I should open it in a native way, just like clicking mp4 file on file browser. I do know that there are a lot of dependencies that allow me play videos inside react native, I just consider that playing video in native way provides more options for users and lesser bugs whenever save or share it. So, do you guys have any ideas that allow open the video file in a native way? Very thanks!
You need to implement react-native-video for online streaming and if you have downloaded file then you can just use Linking by react-native
I have found a way that by using react-native-viewer can open the mp4 file natively

How to store the filepath to the video in Android SQlite database and access them?

I'm creating a gaming application for android which involves videos and other medias to be displayed for each question.I stored my images in drawable folder and accessed them in database, similar way i tried to store the videos in RAW folder and tried to access its not accessing.how can i achieve this?

Develop a KML layer with specifying KML file content as string only?

We can develop a KML layer as follows:
var crosshairLayer = new google.maps.KmlLayer('KML File PATH');
crosshairLayer.setMap(map);
For this we have to upload a kml file somewhere on internet and then we have to pass kml file URL in the new google.maps.KmlLayer('KML File PATH') constructor.
Can we develop KML Layer specifying KML content only. I dont want to upload the KML file somewhere and then using its URL.
The geoxml3 parser has a parseKmlString method which takes a string containing valid KML and parses it to produce native Google Maps API v3 objects (so you lose the benefit of tile based rendering you get with KmlLayer, whether that will be efficient enough will depend on how complex your KML is).
The api does not support this directly. You'll need to use a 3rd party kml parser. See How to read KML file

Handling zip files via media browser

I am using media module with wysiwyg integration of media browser.
I need to create a new file type (say zip) and have custom formatters for this file type. So, whenever a zip file is uploaded via media browser, i want it to get associated with "zip" file type and the formatters should be applied to it as selected by the user.
Tried to look for some tutorials but not much of help. Can someone please guide me through with this?
Thanks.

Resources