# Animated Gif loading too slow/choppy Iphone



## christinewulfit (Apr 30, 2016)

Hi everyone/anyone can someone please tell me why this animation loads so slowly on Iphone.
Works fine on Ipad.
http://centredentairegk.com/


----------



## JiminSA (Dec 15, 2011)

Yes it is a known problem ... "The theory is that the native YouTube app is pulling in whatever the highest quality HD version of that particular video is - so it might be loading a very large 720p or 1080p video, which can take some time." from this "fix" link


----------



## christinewulfit (Apr 30, 2016)

Hello JiminSA! Hi,, this is animated gif that only appears for mobile formats, the youtube video only appears is for desktop


----------



## JiminSA (Dec 15, 2011)

Yes, your .gif file does appear in Chrome's Mobile simulator followed immediately by the youtube movie embed ...

```
[IMG]images/movie.gif[/IMG]
            [MEDIA=youtube]-JTAHw3sqko[/MEDIA]
```
It seems that the swapping out of the video for the .gif file should take place, but doesn't. I would recommend a closer look at your css


----------



## JiminSA (Dec 15, 2011)

A purely PHP way in which to handle this situation would be as follows:

```
<?php
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
if($detect->isMobile()&&!$detect->isTablet())
{
?>
[IMG]images/movie.gif[/IMG]
<?php
}
else
{
?>
[MEDIA=youtube]-JTAHw3sqko[/MEDIA]
<?php
}
?>
```
You would have download Mobile Detect via this link and incorporate it into your site (it's very small)
afterthought: check those 'hidden' classes in your css and if they are 'display:none' change them to the appropriate 'display:block' classes.


----------



## christinewulfit (Apr 30, 2016)

Chrome is the only simulator the seems to play the gif, Safari and Firefox simulate the youtube video - I can hear the audio.

I have checked my CSS and do not see anything wrong.


----------



## JiminSA (Dec 15, 2011)

I was assuming that the reason for the slow and jerky load was because your iPhone was incorrectly retrieving the video (I am an idjut). But Chrome sim for iPhone retrieves the gif - quickly. Could you confirm that only the gif is displayed on your iPhone? If this is the case then, there is the possibility that the OS on the iPhone still uploads the video even though displaying the gif. Which would explain the slow jerky load. If so, then the Mobile Detect method would cure it.


----------



## christinewulfit (Apr 30, 2016)

If this Chrome is working correctly it is indeed the gif playing as there is no audio, and it is not followed by the youtube video.
However in Firefox and Safari it is indeed the youtube video - there is audio.

When I remove the youtube video, then the gif plays into both Safari and Firefox. 

So following your suggestion I will try and integrate this php into my code, I am just not so familiar with PHP as far as integrating the code with the existing css and html.


----------

