Backbone Marionette - images not displaying reliably on iPad - race condition? - image

This is really weird behavior. Having difficulty even quantifying. Have had to revise a few times.
Best I can do is the following:
The tech stack for my app is Backbone Marionette, handlebars.js, require.js.
The app contains images mostly of icon size - say 32x32 and under. Some jpg, some png, some svg.
Some of the images, the same ones each time, don't display. That's a common issue on which many have posted. No big news there.
But if I hit the sleep button, leave the iPad sit for a minute or two until the unit really goes into hibernate mode, and then revive it, the images slowly and magically fade in. They don't abruptly display when the screen lights. They fade in afterward.
Doesn't work to just hit the sleep button and instantly revive. Have to wait a minute until it truly hibernates.
After true hibernation, no matter how many times I refresh the page, the images are there. But, if I go and clear the cache on Safari and load the page, the images are not there again - until I do that hibernate thing.
All of these images do display without fail in a browser on a PC (all flavors). It's just on the iPad that they don't.
I thought, at first, it was just images I was loading in collection views. It is not. I have a third party HTML5 video player in the app. It has a play button and other controls in svg format. This also exhibits the behavior above.
Once the iPad has hibernated and been revived, the images fade in. Only clearing cache makes them disappear again.
There are no 404 errors when the images don't display (checked in dev console on a MAC). In fact, if I just tap the screen where the video play button is supposed to display, the player begins. So the button seems to actually be there, just not painted on the screen - until you do that hibernate thing.
Some images in the app always load no matter what. I'm looking at those images to see if I can note anything special about them or the code which renders them.
I tend to think it's not the images themselves because the very same images in a plain web page always display on the iPad. Also, that third party video player in a plain web page displays the svg play button and controls without fail on the iPad.
It's just in my app that the behavior occurs. So it's logical to think my app is where the problem lies. I just can't seem to find a common thread for the images that always work vs ones that don't.
Not sure what code I can even post here. I'll look and see what might make sense to post.

Definitely a problem loading images dynamically via the framework. They are there but do not paint. No idea what the problem actually is. Literally only happens on Safari mobile browser. Can't make it happen anywhere else, even old IE. Know one solution that definitely works though. Preload all the images by explicitly including them in a div in your markup. When you load your marionette app, remove the div - $("#preload-images").remove(). Thereafter the images never fail to paint when added dynamically via marionette.

Related

phone inappbrowser doesn't start from full-zoomed-out when it loads huge image

I have a window.open code to launch inappbrowser on phonegap. I use it for displaying image.
This inappbrowser has EnableViewPortScale=yes, so it's totally zoomable.
However, it seems like there is zoom-out-limit in inappbrowser. Here is the code.
window.open(myFullImageUrl, '_blank',
'location=no,EnableViewPortScale=yes,presentationstyle=pagesheet');
It's already zoomed-in a little. I can zoom-in-and-out because of EnableViewPortScale=yes for sure.
However, it seems like there is zoom-out-limit.
when i load up 1024x768 photo, it doesn't show fully zoomed-out photo(on both iOS and Android), but it's like 120%-ish already zoomed in.
I Just created stackoverflow account, so i can't upload photo. sorry!(it says i need 10 reputations to upload image)
There is no true solution for this issue.
So what I did is I just continue using inAppBrowser, but just instead of directly loading image from Amazon server(that's where I stored all images), I just made my window.open to go to another my URL and attach that url as a parameter after '?'.
The reason why I did this is because then I can force the Image web-view to have brief Javascript and CSS to render this dang-image correctly.
And as you guys know, this page must have meta-data that allows user-scale true, and must NOT have max-scale value.
So, Yep. Long story short, If you DIRECTLY load up the image in the inAppBrowser of phonegap, there is NO WAY you can force the image to start with 'not even slightly zoomed-in, but perfectly zoomed-out to the max'. Your own Page, Your own JS and CSS is the way to go guys.

Phonegap and Xcode

I currently have a series of 8 separate html files, with the idea that each one is a separate page in an iPad app. I have used jQuery Mobile to implement the page swipe between pages by using the 'data-next' and 'data-prev' attribute. However, the results are not great as i sometimes get a page flicker when i swipe, and css animations are very choppy when I test it on an actual iPad. I am also getting a 1 second delay before the actual swipe happens. I know JQM has a default delay of 300ms, but this is waaay longer! I have tried using the css 'translate3d' technique on animated elements, but it doesn't seem to fix it. I'm putting it down to JQM just being buggy as hell.
So my question is this..Is it possible to bring these files into Xcode, as separate independent html files, and implement the page swipe within Xcode itself?
No Not possible.
XCode allows you to create/edit UI and Transitions of cocoa touch controls only. However you can just edit these html/javascript files in XCode.

No images are loading in Google Chrome - works fine in Firefox/IE

For some reason when I use Chrome to test out my website, no images load at all, not even tiny ones like loading icons or the simple "back to top of page" arrow icon at the bottom. The browser tab just hangs on the spinning circle loading state. If I refresh it like 10 times or something then a portion of the images might load. Interestingly my Nivo-Slider images never load... there is a large empty space at where the Nivo-Slider gallery should be at the top left of my page no matter how many times I refresh.
The console is completely clean of errors if you check.
Can anyone check for me why my website is not working in Chrome? It works perfectly in Firefox/IE. I admit some images might have large file sizes but it shouldn't cause Chrome to hang for like half an hour?
I'm using latest Chrome/IE/Firefox. Windows 7 64-bit.
My website: www.symphonyofpromise.com/inspiration/en
By the way my website is a completely fictional museum/gallery project, it's not the official site for some museum!
I cannot be 100% certain on this, but judging from the Network panel, you might be loading too many MP3 files at the same time, thus maxing out the number of simultaneous requests. Chrome might use a different prioritization algorithm.
I would recommend removing some of those MP3 files and deferring loading until after the initial load.
EDIT:
Nevermind that, it appears that the MP3s load fine, but other resources are definitely blocking it. A request should never be pending this long. Poke around further in the Network panel and you'll find the problem.

Xcode iOS app loading screen

Looking to do two things where the normal 'default.png' image loads in an iOS app.
For example, like how the 'cut the rope' app starts up.
1) want to display two logo screens on starting (well one logo screen and one loading screen)
2) want to have the second screen animate a 'loading' bar that shows the app loading
Having a lot of difficulty in finding any good examples or tutorials on either!
Anyone got any links or helpful ideas on either of these items?
Thanks!

Chrome Plugin image persists after close

I have been developing a media player browser plugin for the past few month using Firebreath, but I do not think this is a Firebreath problem.
Currently I am stuck on this weird problem that occurs when one tries to reload the webpage containing the plugin. The image that was being displayed before the reload will stay stuck on the top of screen. The new reloaded plugin will be alive and well behind it but the old image will stay stuck their on the screen forever. If I scroll or resize the browser or even change URLs the image will stay put, however If I move the browser the image will follow. The image stays after closing a tab, but leaves when closing the window
Here is a screenshot that demonstrates what I am talking about.
http://i.imgur.com/asB7i.jpg
( I am a new user so I cant post images )
Has you can see I left my plugin's page and went to the Firebreath website and the image still persists.
This problem happens on both windows and linux, much less frequently on linux, and happens when using both directx and opengl. But only happens on chrome.
Just wondering if you, or anybody else, has any thoughts, suggestions, or insights as to what might be happening. I've tried everything including atrocious hacks and nothing seems to work.
Thank you.
Your problem is most likely that you aren't tearing down your directx or opengl context when the DetachedEvent fires. AttachedEvent is the earliest you can set it up, and DetachedEvent is the latest you can leave it running.

Resources