How to offline video content using PWA? - offline

I have few questions on PWA offline videos.
How can I offline the video using the Progressive Web App?
Which storage mechanism should I use to store video data on the client side?
Is there any storage limit browser-wise?
I did offline functionality with text data using PWA using service workers. But stuck in how to do same with video.
Any help will be appreciable.

this is helpful repository
PWA download video manager use local database PouchDB
you can download video and store video Blob data in local Database and Use that offline
https://github.com/mohammadnazari110/pwa_offline_video_download

Related

Django best way to stream video to your frontend (php or react.js)

I want to make a website for watching videos like vimeo or youtube but i have no idea how to watch/stream the videos on the frontend from my django backend.
So i have the videos in my database how will someone watch them from his browser
I think the best way to achieve that is put your videos on separate server (special for videos) and store links for those videos in your django application
after that you can send video link to your frontend and manage it

How to secure VIDEO files streamed from Windows server machine?

I develop a video-streaming application. Using a machine with Windows Server I deliver mp4 video files to the application's users. All the video content is basically public in the Internet. They are simply mp4 files on a machine, with no security rules in place.
Since I want to introduce a subscription option in my application (the users of the app have to pay to view certain videos), securing the video content is a must.
My question is: how can I authenticate the video streaming?

Update Django server after creating thumbnail with AWS Lambda

I have a Django web project that is using Amazon S3 for media files. The file upload is happening async direct from the browser.
I need to create some thumbnail images for each file that is uploaded. I found a tutorial for how to do this using AWS Lambda (which I've never used before) but seems like the future of web.
The only issue I am trying to figure out in my head is: how I will update my database back on the django web server with the information for the newly created thumbnail images? I intend to create a new database model (thumbnails) that will store the URL and tie the thumbmail to the main image information.
The only thing I have come up with is to expose a url on my web app to accept HTTP requests (assuming lambda can send HTTP requests). So when the lambda function completes a thumbnail image, it will send the request to my web app with the information for the newly created thumbnail image using POST or PUT.
The thing I don't like about this approach is that it won't work when developing locally. Does anyone have any experience using Lambda to create thumbnails and then communicating back with your web server which differs from my proposed plan?

Can I use a 3rd party video content portal like youtube to upload and post videos on my own web portal?

I manage a website where users post entertainment content (photos, text). It's developed in Django with postgresql. I am trying to add a video feature on the website - such that everyone can upload their favorite videos on the website and share them.
Instead of building out video streaming infrastructure myself, can I use an existing video service as a viable backend? For instance, using Youtube's API to send all uploaded videos to its servers, and then embed a youtube player in my website that users can utilize to view uploaded videos? Youtube actually imposes a quota, that computes to about 400 video uploads, 1500 write operations, and 50,000 read operations. My website's scale is already beyond this. Are there any other services I can use? Sorry if this is a newbie question, I actually don't have any experience in this domain. If you point me in the right direction, perhaps giving an illustrative example, I can start getting deeper into this.
The closest I have gotten is getting a bizspark plus subscription that is free for one and a half years. After that one can use Azure media services to get the job done.

Does Firebase allow an app to start in offline mode?

I'm thinking of using firebase to write a mobile app using PhoneGap and the HTML5 Application Cache.
Lets suppose each user has a list of TODO items. If the app is started when the phone is offline, will it be able to load data from the previous session and sync when a connection is established? If so I'm wondering how this is implemented because I couldn't find a reference to localStorage in firebase.js.
The short answer is: not yet.
Once an app has connected to Firebase, the client will cache data locally and be able to access data where there is an outstanding "on" callback even after a network connection is lost. However, this data is not persisted to disk, the "offline mode" will only work while the app is still running.
Full offline support will be coming in the future.
edit 2016 : full offline support is now possible for native iOS and Android apps: https://www.firebase.com/blog/2015-05-29-announcing-mobile-offline-support.html
An alternative to Firebase that solves this problem for JS apps is CouchDb (server) <=> PouchDb (JS client). If you've implemented a nice clean client side service layer then porting to PouchDb should be fairly straight forward since both are NoSQL/JSON databases. CouchDb also supports indexed map/reduce views.
PouchDb is a Javascript API that implements a fully offline CouchDb client. It can auto detect and use either local storage, IndexDb or WebSQL to permanently persist local data while online or offline. The PouchDb API can be used to access either your local or remote databases (just change the URL) and wire up full syncing or filtered syncing between the two. There are many useful PouchDb plugins, code samples and a small wrapper library to support AngularJS's Q promises API.
Using PouchDb, you can safely start up your app while offline and then days later restart your app and sync all your CUD data changes to the server. This can result in update collisions so CouchDb supports record versioning that is designed to detect and track this. Consequently, you'll likely need server side logic to resolve these collisions. This is unavoidable for distributed systems with offline synchronization and a key feature of CouchDb. I'm not sure that Firebase supports this MVCC feature.
PouchDb is basically a reimplementation of Apache CouchDb including it's synchronization protocol. Both CouchDb and PouchDb are well tested, free and open source. Being open source means that a CouchDb server can also be deployed as an Intranet service - optionally syncing to an external cloud service. There are a number of CouchDb hosting providers.
IBM's Cloudant hosting team recently added their BigCouch clustering features to Apache CouchDb 2.0 project so now you can scale from Micro Db (PouchDb) => Single Server => Multi-Master (Replicated) => Big Couch Clustered / Geo Clustered. Unlike MongoDb, CouchDb safely supports single server deployment.
NOTE: PouchDb can also sync to CouchBase using the same protocol but Couchbase !== CouchDb. It's a commercial product.
Another cool trick is that PouchDb can be run inside a NodeJS server as a replacement for CouchDb. I think it's not (yet) ready for production use but very handy for unit testing. See express-pouchdb.
Links:
Apache CouchDb Project
Couch Db - The Definitive Guide - Free book.
Pouch Db
AngularJS wrapper for PouchDB
Couchbase
CouchDb Hosters (Updated July 2020)
Compare CouchDb Hosters
Cloudant
Hyve
DIY
How To Install CouchDB and Futon on Ubuntu 12.04 - Digital Ocean
Secure CouchDB by using SSL/HTTPS
Docker + CouchDb:
Dockerizing a CouchDB Service
GitHub: Yet Another Dockerized CouchDB
Dockerized CouchDB 1.6.0 with stud SSL terminator
Security Model
One issue you'll need to consider when migrating to CouchDb is that it has a more limited access control model. This is partly due to it's replication algorithm. This blog post covers this in detail (better than the real definitive guide).
Matt Woodward's Definitive Guide to CouchDB Authentication and Security
CouchDB Security Overview
superlogin is an excellent NodeJS Passport/Authentication API that wrappers CouchDb allowing PouchDb offline apps to support social OAuth logins or username/password accounts. Includes a fully working demo and client side ng-superlogin Angular API.
Adapters
In practice you'll probably want to use WebSQL for your PouchDB storage as it performs much better. - Here's the full details on the storage adapters
PouchDb Extras
There's a staggering array of new cool "Christmas Tree" goodies always poping out the open source door from the prolific PouchDb community.
One the best features of PouchDb is all the open source plugins (37) and UI framework adapters (12).
Very old question, yet problem still persists.
I have been using firebase only for a few days and I couldn't find a satisfactory solution to this problem myself, so I thought I would share what I ended up doing.
On app start I check if I am online navigator.onLine. If not, I read from local storage and restore the firebase ref from it.
export const firebaseFromLocalStorage = (local, storeRef) => {
// assuming data is array
const localData = JSON.parse(localStorage.getItem(local)) || []
localData.map(obj => {
const key = obj['.key']
delete obj['.key']
storeRef
.child(key)
.set(obj)
})
}
Then proceed as normal. When the app goes online it will sync its local state with the server just like when it starts online and loses connection momentarily.
Off course this implies that localStorage needs to be kept in sync with your firebase ref. I do this at each get operation.
Hope this helps