How can I limit my flutter application's bandwidth - android

I'm using a youtube video player in my app and I cannot adjust the quality of the video, it automatically adjusts to the internet speed. I don't want to my app to consume mobile data, so want to limit the app's bandwidth based on the video quality the user chooses.
How can I do this?

Related

Flutter video player using high data

When i use flutter normal video player in my project when video playing high data consumption and data using speed above internet speed indicator show above 3 to 5 MB speed ,
how decease data consumption and how limit data speed
you can use a lower resolution video: Lower resolution videos will have a smaller file size, which will result in less data being used.
se a video streaming service: Instead of downloading the entire video, a streaming service will only download the parts of the video that are currently being watched, which can decrease data usage.
also you can use Limit data speed: You can limit the data speed in your app by using a package like "data_usage" or you can use "flutter_speedometer" package to show the internet speed in your app.

Android Performance difference between saving video files or streaming to server

I'm planning to build a Android app that records a video feed and performs operations on each captured frame from the video. The current app structure follows:
Start recording video
Capture frame
Operate on frame
save frame to a single video file in external storage
Repeat
After recording a 45 second video, the video file in external storage would be sent over a network connection to a server. The video would be recorded at 1080p, 30 FPS.
I'm wondering if there would be a significant performance cost to streaming each frame to an external server instead of creating a video file on device for storage. I'm interested in whether or not streaming each frame would have a greater performance cost than saving each frame. If so, why is this the case? Thanks in advance!
On one hand you will have overhead in terms of data size as my expectation is that compressed video will be ~100x times less than thousands of source frames.
On the other hand building up a video from frames will have a very high CPU footprint therefore will drain the battery.
You can use Android Profiler to check which of the approaches will work faster and have minimal impact on the mobile device itself.
From mobile device perspective (saving CPU and bandwidth) the best option is saving the video stream directly from camera onto your backend server and perform processing there. However in this case you will need to carefully measure performance of your server in order to ensure that it is capable of supporting anticipated amount of mobile users simultaneously uploading video files. See Load Testing Mobile Apps Made Easy article to get the overall idea regarding mobile devices backend performance testing.
You should save it locally first, and then stream it. If the network connection fails (very likely on a mobile device going in/out of wifi/cell reception) during a stream then you'll lose all the data. If you have it saved to a temporary file first then you can upload it and check the the upload succeeded before deleting the temp file.

buffer and play videos faster in VideoView

Using Picasso I was able to download and display my images very quickly in my Android app. Now i want to stream my videos from my S3 server and play them through my app faster than my code here:
try {
MediaController VideoController = new MediaController(VideoPlayerActivity.this);//Creates a media controller to this activity.
VideoController.setAnchorView(AdVideoView);//Adds the media controller to the video view.
Uri video = Uri.parse(VideoURL);//Creates a Uri to hold the URL of the video.
AdVideoView.setMediaController(VideoController);//Add the media controller to the video view.
AdVideoView.setVideoURI(video);//Make the video view play from the Uri.
} catch(Exception e) {
Log.e("Video Stream Error", e.getMessage());//Sets the message for the log.
e.printStackTrace();//Displays the error in the stack trace.
e.notify();
}
Is there a faster way to display videos through a GitHub or better code?
Thanks in advance!
The things that usually slow down streamed video playback are server and network related rather than client side - unless you have a very slow or very busy device it is unlikely it won't be able to play the video back at the rate it is received over the network.
Taking this and assuming you are are seeing delays in your streamed videos, there are a couple of common things to look for.
First, mp4 videos in normal format have the metadata at the end of the video file which is not good for streaming. There is a technique called quickstart, which moves the metadata to the start which you definitely want to use. More info here:
http://multimedia.cx/eggs/improving-qt-faststart/
Secondly, network connections can obviously vary and slow networks make streaming high quality video files a problem. A technique called adaptive bit rate streaming (ABR) allows the client request lower quality video 'chunks' if the network quality is bad and then change to higher quality when it improves.
ABR also helps startup time as it allows you quickly start the video stream by using a lower quality level, and hence smaller size chunk, and then increase the quality as the video progresses. You can see this effect when you start up most online video services, such as Netflix, today (July 2016).
One thing to note is that video hosting and streaming is a specialist area so it is generally easier to leverage existing streaming technologies and services rather than to build them your self. Some good places to look to get a feel for open source solutions:
https://gstreamer.freedesktop.org
http://www.videolan.org/vlc/streaming.html

Allow users to upload HD video to youtube without wifi connection?

I am about to build a large ios/android app but before I do I need to know if it is possible for users to upload video to youtube in high definition without a wifi connection. I will likely keep video max size to 30 seconds and will require HD quality. These files are typically 20M-40M from an iphone (as far as I understand) and there will likely be dozens to a hundred or so users uploading simultaneously all to the company's youtube channel. I was just wondering if I could get some advice on whether or not to attempt to include this feature in our app, or perhaps get some thoughts on what will happen if I do.

How to determine the highest video resolution and/or bitrate that a device (Android) can playback?

I'm working on an app that needs to play multiple MP4 videos. We have transcoded these videos into multiple resolutions in an attempt to provide the best playback experience for our users. For streaming, we also provide HLS for devices that support it, but we also provide the ability for users to download video for offline playback.
My question is: for a given Android device, is there a way for me to programmatically determine what the maximum resolution and/or bitrate that it can handle?

Categories

Resources