Displaying animated images in a mobile browser
A system and a method are disclosed for displaying animated images in a mobile web browser. The system requests to download a frame in a sequence of image frames, wherein the sequence of frames is extracted from a video clip with an inter-frame duration. The system then measures the downloading time for the frame. Next, the system displays the frame in the mobile web browser. The system also determines a next frame for downloading based on the inter-frame duration and measured downloading time of the displayed frame.
1. A method for displaying animated images in a mobile browser, the method comprising:
requesting to download an image with a first index number in a sequence of image frames by a mobile browser, the sequence of image frames extracted from a video file with an inter-frame duration;
measuring the download time for the image with the first index number, the download time measured as a multiple of the inter-frame duration;
maintaining a periodic playback timer that has a period of the inter-frame duration;
displaying the image with the first index number in the mobile browser during the period corresponding to the first index number based on the periodic playback timer; and
determining a next image with a second index number based on the measured download time and the first index number.
2. The method of claim 1 , further comprising:
recording all the measured download time of previously requested images in the sequence of frames;
generating a smoothed value that is a moving average of all the previously measured download time; and
calculating the second index number of the next image to request by adding the smoothed value to the first index number.
3. The method of claim 1 , wherein the download time for the images in the sequence of image frames is measured as a multiple of the inter-frame duration.
4. The method of claim 1 , wherein the periodic playback timer has a period of the inter-frame duration.
5. The method of claim 1 , wherein the image with the first index number is displayed during a period corresponding to the first index number.
6. The method of claim 5 , wherein the image with the first index number is not displayed if received after the period corresponding to the first index number.
7. The method of claim 1 , wherein the second index number of the next image to request is determined by adding the measured download time to the first index number.
8. The method of claim 1 , further comprising:
recording all the measured download time of previously requested images in the sequence of frames;
generating a smoothed value of all the measured download time; and
calculating the second index number of the next image to request by adding the smoothed value to the first index number.
9. The method of claim 8 , wherein the smoothed value is a moving average of the previously measured download time.
10. A method for displaying animated images in a mobile browser, the method comprising:
requesting to download an image with a first index number in a sequence of image frames by a mobile browser, the sequence of image frames extracted from a video file with an inter-frame duration;
measuring the download time for the image with the first index number;
determining when to display the image the mobile browser based on a periodic playback timer; and
determining a next image with a second index number to request based on the first index number and measured download time.
11. A non-transitory computer-readable storage medium storing executable computer program instructions for displaying animated images in a mobile browser, the computer program instructions comprising instructions for:
requesting to download an image with a first index number in a sequence of image frames by a mobile browser, the sequence of image frames extracted from a video file with an inter-frame duration;
measuring the download time for the image with the first index number;
determining when to display the image the mobile browser based on a periodic playback timer; and
determining a next image with a second index number to request based on the first index number and measured download time.
12. The non-transitory computer-readable storage medium of claim 11 , wherein the download time for the images in the sequence of image frames is measured as a multiple of the inter-frame duration.
13. The non-transitory computer-readable storage medium of claim 11 , wherein the periodic playback timer has a period of the inter-frame duration.
14. The non-transitory computer-readable storage medium of claim 11 , wherein the image with the first index number is displayed during a period corresponding to the first index number.
15. The non-transitory computer-readable storage medium of claim 14 , wherein the image with the first index number is not displayed if received after the period corresponding to the first index number.
16. The non-transitory computer-readable storage medium of claim 11 , wherein the second index number of the next image to request is determined by adding the measured download time to the first index number.
17. The non-transitory computer-readable storage medium of claim 11 , further comprising instructions for:
recording all the measured download time of previously requested images in the sequence of frames;
generating a smoothed value of all the measured download time; and
calculating the second index number of the next image to request by adding the smoothed value to the first index number.
18. The method of claim 17 , wherein the smoothed value is a moving average of the previously measured download time.