Video Streaming from Google Cloud Storage - android

How would we go about getting a video from google cloud storage and streaming that video to a mobile device?
I dont see anything related to videos in the Java API like there is for getting images with ImagesServiceFactory
The videos are only going to be a maximum of 10-15 seconds long if that makes any difference.
Any advice on how to proceed here would be great

There is no difference between streaming a video and downloading any other file from the Cloud Storage. Thus, no special video API.
If the files are not public, you need a servlet that will read the content of the video from Cloud Storage and stream it to the client. Note that you cannot run it on App Engine or managed VM as they do not support file streaming and the request size is limited to 32MB.
Your best option is to run this on a Compute Engine instance:
Bandwidth between Compute Engine and Cloud Storage is free.
Authentication is simple.
Alternatively, you may use a signed URL for your video files. This saves you from developing/deploying a separate Compute Engine instance just for the streaming purposes - signed URLs can be returned by your existing backend.

Related

Video is not playing fetched from azure blob storage

I am creating an application in which I upload any video from mobile through browser
It stores in blob storage but when I try to fetch it and play it in media player of android there is error in logcat saying "can't open the file" and same is happening if I upload a video from laptop which record by mobile
Why this is happening ? Does codec format of mobile video plays vital role in it ? If yes then what should I do
Thank you in advance
There are something we need to check when streaming video in Azure storage:
1. Check your upload tools.
Includes the tools and the settings, such as bit rate. Sometimes the issue comes with half-baked tools or the transmitting settings.
2. Check your Blob Type.
Make sure your videos are BlockBlobs. Check the header x-ms-blob-type. There are BlockBlobs and PageBlobs … but for streaming video you want BlockBlobs.
3. Check your storage version. It is no problem if we use General-purpose v2 accounts by default.
Azure Storage offers several types of storage accounts. Each type supports different features and has its own pricing model. Consider these differences before you create a storage account to determine the type of account that is best for your applications.
4. Check your video codec format and size.
Storage clients default to a 128 MiB maximum single blob upload. You can see the details in block blobs. For Input video codecs supported, you can refer to the docs.
Reference: this blog post by Tom.

Stream mp3s From Firebase Storage

Issue
I am building a backend service that creates mp3s for an Android client to stream via ExoPlayer.
Looking at Firebase's Storage Pricing in the long term, if there are 10 gbs stored and 10,000 users there would be 100,000 gb to transfer which is very expensive ($11,600).
What would be the best solution to stream mp3s on the cloud in order to avoid data transfer fees?
Possible Solutions
Use ExoPlayer to stream mp3s directly from the cloud without downloading.
Use a separate API to download the 10gb from Cloud Storage one time, and stream the mp3s to the mobile client from the separate API.
Possible solution #1 is the best solution: Use ExoPlayer to stream mp3s directly from the cloud without downloading.
Thank you Oliver Woodman on the ExoPlayer team for resolving this question on Github!
If a mp3 file is saved to the cloud, ie:Firebase Storage / Google Cloud Storage, can the file be streamed from Exoplayer without needing to download the full file size?
Yes. That's just what happens by default when you use ExoPlayer to play a stream.
If the mp3 can be streamed directly from Cloud Storage roughly what percentage of memory of the file is used in the transfer of the stream since the file itself is not being downloaded?
You can configure this by instantiating your own DefaultLoadControl, which you can pass to ExoPlayerFactory.newSimpleInstance when building the player. You can also implement your own LoadControl from scratch if you need more control.
Note that whilst buffering less far ahead saves on data transfer costs, it also makes re-buffers more likely to occur because the player will be less able to ride out temporary network connectivity issues.

Protecting Assets in Cordova/Phonegap Application

I am working on a cordova android application which will display images and videos.I have the images and videos in the assets folder.I want to protect my resources.I don't want anyone to copy the resources.I have googled for the same and didn't get any proper solution.How to protect files in assets?
Is there any way to encrypt and store videos in assets folder and decrypt it during run time?
My video files will be maximum of 10 MB each file and there are 50 videos in the whole application.
You can definitely do this with DRM - it won't stop someone copying the video files, but as they are encrypted they will not be able to play them back without the correct key.
The process is roughly:
your content is encrypted before it is streamed or downloaded
when the user wants to playback the content the app must request a key for the content from owner of the content or the 'rights authority' (a service which handles keys for content)
The DRM system on the device will securely encrypt the content and play it back using the key it obtained. The video will not be stored in clear format at any point.
Native Android DRM is explained here:
http://developer.android.com/reference/android/drm/package-summary.html
To use this with cordova I think you will have to create a Native plugin - I could not see any cordova DRM API. Alternatively, if you are able to stream the content using the new MPEG DASH format, then you could use a HTML5 video player which supports DRM, such as BitDASH (https://www.dash-player.com).
You need to be aware that all DRM and encryption systems are really just hurdles that make it harder to copy content - at the end of the day if you have a very high quality display and a very high quality camera to record the display, then no DRM protection will save you.

stream video on device bytewise to videoview - Android

I want to play encrypted video files present on my device after decrypting them. I want to pre-process the data-stream and parallel play it using videoview like streaming video from Internet.
Is there any way I could buffer the processed data to videoview like a network stream ?
I think you are saying that you want to decrypt the video in one process and then pass the decrypted 'clear stream' video to another process to play it?
If the video is DRM protected, then your use case is very unlikely to be supported by any of the leading DRM solutions - they go to great lengths to ensure the clear stream video is not accessible by an application on the device (for obvious reasons).
If you are using or a simple encryption with the encryption key available to your application then you should be able to do this.
Update
Answering BMvit's question in the comment - one way is to follow these steps:
Stream the encrypted file from the server as usual, 'chunk by chunk'
On your Android device, read from the stream and decrypt each chunk as it is received
Using a localhost http server on your Android device, now 'serve' the decrypted chunks to the MediaPlayer (the media player should be set up to use a URL pointing at your localhost http server)
I am guessing this is the most likely the approach that the libMedia library uses, although I have never seen the source so I could not say for sure: http://libeasy.alwaysdata.net
It is worth being aware that this is tricky (which is probably why LibMedia is not free).

How to upload short videos (10-15 secs) from an Android App to AWS using Node.js?

Once the application gives me a GET Request for the file along with the video,
what should we use in our Node.JS file to correctly optimize the video, compress/encode the video in which format and minimize the uploading time for end user?
I understand the file needs to be asynchronously uploaded. But what should be my backend systems be designed like?
We'll be using AWS, and Mongo DB. So all the videos will be uploaded to S3 Bucket. Is this the best practice?
Basic requirement is I am trying to make the uploading video as much scalable and concurrent for multiple users to upload video.
Are there any kind of best practices or tutorial for the kind of video formatting and uploading in Node.JS we are looking for?

Categories

Resources