I have an cordova ios application where I show a different gif upon swipe up and swipe up.
But when I swipe up the first gif the second gif doesn't start playing properly from it's first frame like it should.
Instead the second gif shows the last frame of the second gif first and then only it starts playing.
Please see the attached gif herewith.
Because of this it creates an ugly flicker on each image swipe up on the ipad app.
Could someone please point me out what I am doing wrong or what should I be doing differently to fix this issue ?.
I am tesing using ios 9.1.
I think I have a partial answer.
My problem resulted from splitting one rendered image sequence from After Effects into multiple animated gifs in Photoshop.
I think it must have something to do with the way the images are referenced in the image sequence that messes up the final animated gif. Possibly because it loses information about which images are first or last in the process.
I fixed the problem by rendering each image sequence separately then opening each image sequence in Photoshop and saving them as animated gifs separately as well.
Related
I am working with a loading gif on a website and it works correctly on all browsers except Microsoft edge. With edge, the gif runs all the way through the loading circle, but at what I assume is the last frame*, a sliver of the gif freezes and stays there as the gif continues to play through again. Once it happens one time, it will continue to happen until the user leaves the page. I can't put up a link to show the actual gif I am struggling with,
however I just created something quickly in paint.net and threw it into an online animation tool to show what it is doing.
https://giphy.com/gifs/QsUAu5ud4ibIdq97sm
So with this quick gif I just created, once that red mark shows up, it will show up every time after the initial load of the gif.
*I am just assuming it is the last frame but I can not access a copy of the gif before it was compiled into gif format so I don't know how much of the loading animation is in each frame
What I am asking is if anyone knows how to fix this issue when using edge. I am limited because I cannot change the gif itself in anyway or change
the frame rate of the gif. Any ideas are welcome because I am all out of ideas and have spent hours scrolling through
pages online looking for a solution and haven't come across anything close to what is happening here.
Also this is how the gif is being created on the page with the html. Not sure if this is helpful in this case or not:
<div style="text-align:center">
<img src="~/Content/images/GIF-loading.gif" id="loadingGif" />
</div>
I have tried to create a sample using your code and download a loading image from here, it seems that it works well on Microsoft Edge 44 and Edge 42, the result like this. So, I think you could try to download a new loading image and retest it on your side.
In the app I have a UICollectionView with item size so that about ~20 items are visible on the screen at the same time. The content that I want to display in each cell is Gif image downloaded from Giphy / Tenor.
However, I realized that gif files take much more space (and time to load) than the relative mp4 files that both Tenor and Giphy provide for each animated image, which is actually obvious, cause mp4 file format has a compressing logic and stuff like that. Sorry if I use wrong terms.
In order to have list loaded faster I decided to switch using UIImageView with GIF images to AVPlayerLayer, cause mp4 file is like ~10x lighter than GIF image. But I faced with the performance issue similar to what described HERE. The flow is mostly the same, I have 20+ items visible at the same time, but because of hardware limitations it only shows 16 videos. I couldn't find any workaround or any other frameworks that would allow to have more than 16 AVPlayerLayer showing video at the same time.
I'm wondering how WhatsApp application works and handles this logic. It also has GIF selection from Tenor. I already checked and figured out that WhatsApp downloads small video files and not gif images. That's why it loads very fast. But I have no idea how they can show 20+ items at the same time. HERE is how that works in WhatsApp - https://media.giphy.com/media/33E84h3RAVn0vQWZak/giphy.gif. Also, I notices during scroll the small static previews are showing, but I don't see the app making requests for it. Probably they gets a first frame of the gif on the fly without any delays in main thread.
I also tried that, but even if I make every single stuff in background thread and the only line on the main thread is "self.imageView.image = myImage", it anyway is lugging a little bit if I have 8 items in the row for example and scrolling very fast.
I see only 2 possible solutions to have it loads fast (so we definitely need to load mp4 instead of gifs), and scroll smooth and without lugs:
1. WhatsApp uses its own custom Video Core to display video in the UICollectionViewCell .
2. WhatsApp downloads video to speed up the download process but then encodes mp4 file to gif one on the fly and use regular animated UIImageView to show the output gif file. However I was not able to have this flow working very fast without lugging during 'massive' scrolling
Any thoughts on how to implement the same to make it works fast and smooth as in WhatsApp? I'm unable to check how it handles the downloaded info, but for sure it downloads mp4 files and not gif ones.
My problem is that I want to show a gif in the UIImageView while downloading a picture from remote server. After I downloaded the picture from remote server, I want this downloaded picture to be shown on the screen.
Without problem, I achieved showing the downloaded picture on the screen, which is not difficult of course. However, I could not achieve displaying a custom preinstalled gif in my local while trying to download that picture. Default ActivityIndicator icon appears while downloading.
I did try a few things but I still could not make it. Is there any suggestion for that ?
I put some pictures:
Before I began to download: UImageView with white background color
After I started to download image for UImageView: default activity indicator
Downloaded image: Which I wanted so.
I just want to replace second picture: Activity indicator with my gif. I hope I am understood.
You cannot play a gif format file in a UIImageView. If you have an array of images, you can ainmate them in the imageView and it will be just like a gif.You can also repeat the animation if you want to.
You need to add UIImage+animatedGIF category to support gif in imageView.
If you want to play gifs from the url, you can consider the webView instead of imageView.
There is no built-in support for animated GIFs in iOS. I found a third-party framework that lets you display animated GIFs. I'm not at my Mac right now so I don't have the info, but it looks like there are quite a few libraries that offer animated GIF support on Github.
As Mr. T. says you can also use an array of images in UIImageView to get the same effect. (And there are tools that let you decompose an animated GIF into its frames.)
I am having an issue where my animated .gif (created in PhotoShop) transitions are not rolling out correctly on an iPad and iPhone.
Instead of fading to the next frame, the next frame is appearing a yellow object without having the smooth fade to it.
It is animating just not a smooth animation.
You may wish to use imagemagick to see if it can solve the problem for you. I've just had to deal with a GIF file which has been working without any issue on desktop browsers, but on ios it has been showing strange blue artifacts.
Just run the GIF through the convert function and then try the output file.
convert original_file.gif output_file.gif
Imagemagick will probably decode the original file before creating a fresh new output, but without including whatever encoding style caused problems in the original.
I have a problem that I just haven't been able to figure out. I have an app done that will take a picture from the front and one from the back camera, then merge them together.
The name of the app is GroupCam
However I have an issue in where my UIButtons will not be loaded as retina images from the start. If i set them as #2x on the interface builder they do appear in high quality but once I reload them programmatically the low versions will appear instead.
This is due to the fact that, after a picture is taken and the screen changes the button images change, but when the user presses the back button the camera icons will look horrible (because the low quality versions are being loaded).
Please check the following pictures:
First Screen: Only the upper right button appears distorted because I am checking the value of the camera flash and "loading" the corresponding image programatically.
Second Screen: The user has moved to another screen and came back to the first one, all buttons were reloaded and they now all look distorted.
Why is this happening?
Edit:
This is how I load the images.
[self.flashButton setImage:[UIImage imageNamed:#"flashOff"]
forState:UIControlStateNormal];
I read somewhere on the internet that doing this will automatically load the most suitable version of the image.
I also tried this but the result is the same:
[self.takeButton setImage:[UIImage imageNamed:#"takePhoto.png"] forState:UIControlStateNormal];
First off, its probably worth verifying that the low-res versions are actually being displayed. I had jumped to a similar assumption recently, swapped out the low-res version of the image with something different, and confirmed that the hi-res version was actually still being displayed, but was being distorted.
My actual problem, I had set
<uibutton_superview>.layer.shouldRasterize = YES;
If any of the buttons ancestors have this set, it could likely be your problem.
If your app is taking a picture from the front camera and one from the back camera and merging them together, then the device requires a front facing camera. All iOS devices which have front facing cameras also have retina display's (so long as your not developing for the iPad 2, but that's a different story) so you shouldn't really have to have normal images at all, so all your images should be retina images. If there are no normal images, then this issue shouldn't happen at all. Make a backup copy, and try deleting all the normal images, and then try. Because your using the UIImage imageNamed:#"ImageName", like you said, should automatically select the image! Good Luck!
The case of the filenames of the images does not matter on the simulator, but does on the device.
Use all consistent case. Image.png and image#2x.png are recognized and will work together in simulator but not on device. use image.png and image#2x.png. Or you can also use .jpg as long as case is matching.