Retrieving Local File metadata using Javascript / HTML5 - javascript

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?

Related

How to display a video on the site without the user being able to download it in any way. In ASP.Net MVC

I am going to build an educational site where users will not have access to the original video file and will only be able to watch it through the site. Is there a way that the file is not recognized by the IDM plugin?
According to the articles I read on the Internet, blob can be used, but there was no solution for local use of Azure Storage blob.
In terms of preventing downloads via browser plugins like IDM, you can use
streaming to send the video content in small chunks rather than as a single file. This can make it hard for plugins to intercept and download the entire file. Azure Blob Storage supports "pseudo streaming" of video content via the "Range" header in HTTP requests. This can be useful - https://stackoverflow.com/a/15166547/13105803
Or another option is to use Azure media service

Playing a locally saved video in Angular

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).

FineUpload - deleting local copy of uploaded image

I'm using fineupload S3 in an angular mobile web application to handle the capture and upload of images from the device camera.
I have a requirement to make sure that the captured images are not displayed in the device gallery and not stored on the device. (image and video)
The deleteFile function of fineupload doesn't appear to handle this task and it instead looks like its designed to delete the uploaded file from the server.
So i'm looking for a solution to either prevent the device from storing the captured images in the first place or to delete the files once they've been uploaded.
As far as I know the browser (either mobile or desktop) does not have the privileges to manipulate the file system. If your using cordova/phonegap you should try removing the photo with the file system API provided by them.

Is there any way to display pdf files in browser such that the viewer can only read the file and can't save/download/print the file in any form

I have to integrate pdf files in my PHP web application such that the viewer of the file can not save/download/print the pdf file.
I am finding a way of doing this in any way like using javascript, jquery or straight in PHP or any other way if any.
I think you'd need a custom PDF viewer in your app, like what Google Drive does with images and documents.
I'm not aware of any functionality that allows an app to tell Chrome/Firefox or the registered PDF handler to limit user interaction like you mention.

Hope to create gmail attachment preview like functionality using angularjs

I have a requirement where I want to show the file preview to the users.
There are various file types which are supported like; .pdf, .xlsx, .doc, .rar, .jpeg, .png and many more.
When user clicks on the preview it should open the file in popup where preview of the file is shown to him. User can Zoom-in, Zoom-out, Download the file. Just as you can see into gmail for attachment preview.
Please, can anyone guide me to any relevant library or helpful resource for the same.
Thanks in advance
There are two main ways you can do this.
1) Server-side: Render previews once server-side (on file upload) into jpg/png images, and store the previews on the server. This is the easiest to implement on the client side, but requires extra storage on the server.
2) Client-side: Render the previews 'live' with javascript in browser, this reduces the amount the server has to do/store, but does require the client to fully download the file in-memory before it can render the preview, which for large files could be an issue. Also, you would need javascript libraries included for likely each individual file type, since most libraries will target one specific file format.
Server-Side is probably the recommended way to go. What are you using for your web server?
You are looking at creating document viewer.
Belive me its big work as browser does not understand these formats. Browser can render images directly on canvas but it does not know how to render the other files. So, any file other than image formats, one need to save them temporarily on server and then stream on the browser and show them using the respective file viewer.
You can convert doc and xlsx files to pdf and show these files using pdf viewer (http://ngmodules.org/modules/ng-pdfviewer). There are plenty of document converters available on internet (however you will need to check the licensing terms as most of them are GPL licensed, hense can not be used in commercial projects).
If you want to save this work then go for third party server those take all paint to convert documents in html5 such as https://crocodoc.com/why-crocodoc/
You can also try using google doc viewer google doc veiwer
This question is fairly broad. I'm not going through all the steps of how to implement an attachment viewer directive, but here are some pointers you might find useful.
To allow the user to download the file, you simply put a download link somewhere. If you are hosting the attachment on Amazon S3, Google Cloud Storage or some other cloud storage service, check their documentation. If you're downloading the files from your own server, make sure to set the Content-Disposition HTTP response header to attachment; filename="ORIGINAL_FILENAME", where ORIGINAL_FILENAME is the file name you want to user to see in the save dialog that appears when they click the download link.
Now on to the viewer.
For PDF files, I'd use pdfJS. There's an angular directive for it here.
You could look at something like CloudConvert for other files, to convert ehm to a PDF, and then displaying them in pdfJS, but then you probably want to store the PDF on your server as well, in addition to the original files, which requires extra storage. You might also be able to use the Google Docs viewer, or Office 365 viewer, as described in this answer.

Categories

Resources