If you are developing an app similar to Instagram, Twitter, … , user will received lots of media content like Photo and video;
One photo’s size is usually 500K; If an user receives 100 photo, it will consume 50M, that will make your users feel uncomfortable to your app because the cost of mobile data still is high in some operators;
Diagnosis is to the problem
Before step into the problems, we need to discuss what will drive the traffic;
- Unnecessary data and request
- Too big media file size
Solving the problems
Unnecessary data and request
There are two things to check about “unnecessary data requests”:
First, is there any data that not really needed at the moment?
For example, the following list of an user, the user just read about 20 user’s profiles once, so we don’t need to load all the user’s profiles (e.g 500) at once; Usually the user just browse a few pages, data traffic is saved.
Second, is there any data you can cached?
Cache is the most important technique to save the app usage as well as responsiveness; Most of the popular app using cache, saving the data in your local device;
For example, Whatsapp save the chat data includes text, image, video also user’s profile pictures in our device, so that we don’t need to load from server in the future;
Third, is there any necessary overhead in your protocol?
There are two kinds of overhead in the protocols in our apps;
One is using bigger data type; For example, a data only have 3 available value, you can use “byte” instead of “int”;
One is due to lack of refactoring, sometimes we may leave some unused data in the protocol after several changes during the development
Too big media file size
When your app involve media files, they will incur lots of data;
We should consider the following things about the media file to optimize the data usage:
1. How big is the content required ?
To deal with media files, you need clear how you use the files;
If your user need the media files for backup like Dropbox, google drives, you cannot resize the length or dimension of the media files you given to you;
However, if your user is just for social sharing on mobile, the dimension of the photo isn’t required to be very big, it only big enough to view in mobile device e.g 1080 x 1920; Also you can limited the audio or video length to one minutes like what Vine do;
2. How much can the content being compressed?
Media file compression is a very key parameter to the network traffic. The better compression, the fewer network traffic is created.
However, this question will induce another question:
How good is required for your media content?
This is because high Compression will trade off Media Quality (Sound Quality or Image Clearness);
If you are okay to compress your content, you can choose how to compress it:
- Media file format: Different format provide different compression efficiency.
- Compression Ratio: The smaller ratio is, the smaller the media file size will be
For my option in image content, I use JPEG with 40% compression, it is quite good.