I have an application which is build in react and electron. It is used to capture images and videos from webcam.
Now I want to add a functionality to store those images and videos into the folder or into local db of chrome and also I want to reload those images and video when application restart.
How can I achieve this task ?
I have images and video as in variables in frontend so I can do the localdb stuff but how can I achieve file based storage?
how you can do is, you can store photos or videos on a local storage folder like app data and then just access it using the path. you can store videos in app data as app.getPath('').it's simple as that. let me know if you haven't done yet
Related
I'm building a small Angular application, in which the user should be able to view a collection of locally saved videos and save the collection in order to rewatch these videos at a later point in time. The paths of the videos are saved in a JSON-File, which means I only have access to the string of a path like this:
C:\My Videos\UploadedVideo.mp4
Passing this path to the src of a video-HTML-element doesn't allow me to play it though. I've seen workarounds where a input-element is used and the file is passed to the video-element, but this doesn't work in my case as I have the file path and don't want the user to reselect the videos over and over again.
You're not able to use your system path in browser.
You have two options:
Add your videos to your Assets folder in Angular
Put video online (eg: create Bucket on Amazon S3 for this kind of files and access it via the bucket link).
I'm creating an audio file and it seems working fine because the indicator that it records and audio shows no error. But after the app generates the directory, I can't locate it on local storage.
I am using this code
var audioFolder = fs.knownFolders.currentApp().getFolder("audio");
This code shows
enter image description here
This what I get when I tried to locate it on local storage
enter image description here
Current app directory is something that is only visible to your app, so you will not be able to locate it with any file manager apps.
If you like other apps to access those audio files, be visible in any file manager apps, then use external storage directory.
I am trying to create a media library and will have a component where anyone will be able to upload media .mp4 files that are stored locally on the client's pc.
I want to have a functionality where the user selects the file and Video/Audio metadata is loaded. Is there a way using Javascript/HTML5 to obtain this metadata like in the screenshot below?
There is a Meteor.js app, which is suppose to stay fully functional in offline mode. This app enables users to upload their images and use those images to create content within the app.
Question - how to approach image upload in the Meteor.js app, so that the app stays fully functional in offline mode?
My thoughts so far:
--There is Meteor Offline Data project, but it is still very much work in progress, and it only works for text content: https://github.com/awwx/meteor-offline-data
--In offline, when adding the image in the app, I could detect offline mode and utilize HTML5 File API for using the image locally
--When online is detected, the image is uploaded to the server behind the scenes
--In online content with images is downloaded to the app and saved for offline usage using App Cache
There are still many things unclear, so any hints are appreciated at this point.
You may want to try collectionFS, https://atmosphere.meteor.com/package/collectionFS, as it make a client side collection that the file is added to. The clientside collection should sink when the internet reconnects.
Can a web app load an image from it's local store onto the webpage?
Thanks
What do you mean by "local store"?
If you mean the HTML5 applicationCache, then yes, any images that are in the applicationCache are available for use online or offline.
If you mean from the Web SQL database or the localStorage API, then yes, but the images must be base64-encoded as text and then loaded as data URLs.
If you mean the photos in the user's personal collection on a mobile device or computer, then no, that's not possible.
Use a manifest file. Google it.
It's 2 lines of code and you need to declare it in your .htaccess file
I should think not, as it can open vulnerable security risk:
If a web app can load an image from local storage, it means that there's a facility to browse local storage device (either via the browser JS engine or the web app). The malicious attacker can use this to gain valuable user information.
If the image could be loaded, what will be the path of the image? And if this path is valid, can every user viewing your web application open the image?
iPad doesn't have a storage directory like a PC (i.e. directory structure, e.g. home/user/* structure). Each application can store data that is only visible to the application (unless the application can allow sharing).
It's better to store image on server machine and load images from there.