Topic: Re-using a SimpleViewer object embedded in a page

I embedded SimpleViewer in my html page. When a user selects a gallery in the menu, SV.simpleviewer.load(...) is called for displaying the gallery. When the user selects another gallery, SV.simpleviewer.load(...) is called again.
I know, your horizontal- and vertical-template examples have another approach, but I’d prefer mine.
My site is here: ionstravels.ro/mainpage.html?nomobile=true

It seems to be ok, excepting that, for HTML5 galleries on WebKit based browsers, starting with the second displayed gallery, change orientation / resize stop working:
- on Safari mobile on mobile devices (iPhone, Android), starting with the second displayed gallery change orientation doesn’t work
- on Chrome or Safari on PCs, Flash disabled, starting with the second displayed gallery resizing doesn’t work; (note: IE, FF are ok!)

Now the question: Is there any method for ‘resetting’ a SimpleViewer object before reusing it? Something like:
SV.simpleviewer.reset();
SV.simpleviewer.load(...);

If not, could you provide it in a future version?

Thanks,
Ion

Last edited by jviewer (2011-03-20 08:38:03)

Re: Re-using a SimpleViewer object embedded in a page

no answers... ok, I’ll reformulate...

It is about the following scenario: it’s a page embedding a gallery, where, when the user selects a new gallery from a menu, the existing gallery is replaced by the new one by calling SV.simpleviewer.load(...) again. And so on, gallery after gallery.

In the above scenario, there is a bug for HTML5 galleries in WebKit browsers (this means that for Chrome or Safari on PCs, the Flash has to be disabled): starting with the second displayed gallery, resize / change orientation doesn’t work anymore. Why? After some digging I found that SimpleViewer tries to resize ALL the galleries it has ever opened, starting with the first one. Because the first gallery does not exist anymore, and SV doesn’t check for this situation, the resize function fails and is cancelled before resizing the last gallery (the only one which actually exists).

But, even if the bug will be fixed in the next version of SV, I still have a question: does SV really support the described scenario - which, I think, is not a so exotic one :-)? No memory consumption for the not discarded HTML5 galleries?

Re: Re-using a SimpleViewer object embedded in a page

Thank you for pointing out the bug, we will take a look. Currently the unload features deal mostly with the flash version, but the non-flash mobile gallery is still in active development and not yet feature complete. For example if you are loading the flash into another SWF you can use adobes unload methods.  There is also a SimpleViewer API method to despose() of the current SimpleViewer instance, but I don't know if support has been implemented for this in the non-flash mobile gallery.

Mike Richards
SimpleViewer Support Team.

Re: Re-using a SimpleViewer object embedded in a page

Your page works OK on a mac. Workarounds would be to use iframes or to navigate to a new HTML page on selecting a gallery.

Felix Turner
SimpleViewer Support Team.

Re: Re-using a SimpleViewer object embedded in a page

did you disable flash?

Re: Re-using a SimpleViewer object embedded in a page

I have been doing some research on mobile development and it looks like there is a bug in the iphone's code for resizing, you can find a fix in the link bellow that may help with this issue.

http://www.blog.highub.com/mobile-2/a-f … scale-bug/

Mike Richards
SimpleViewer Support Team.

Re: Re-using a SimpleViewer object embedded in a page

Thank you Mike for the hint.

Unfortunately, the problem is in SV. After some digging, I found there a function, "removeExtraNavList", called on resize for every gallery ever opened. This function calls (for Webkit based browsers)
b = document.getElementById(...)
which fails if the gallery is not available any more in the page (which was my case). Should only be tested for failure: if (b) {...}

Anyway, I decided to use iframes, as Felix suggested, as resizing wasn't the only problem.
But, for iframes I faced another issue: when embedding the Mobile Player in an iframe, the fullscreen function is disabled.
So, is it possible to provide the fullscreen functionality somehow? please...

Thanks,
Ion

Re: Re-using a SimpleViewer object embedded in a page

SimpleViewer 2.1.3 fixed the mobile sizing issue.

http://www.simpleviewer.net/simpleviewer/history.html

Mike Richards
SimpleViewer Support Team.

Re: Re-using a SimpleViewer object embedded in a page

For sure 2.1.3 fixed some sizing related bugs, but the bug I described in this post wasn't fixed.

Anyway, I repeat, as long as the Mobile Player cannot be used in the way I suggested, i.e.
- load a gallery
  simpleviewer.load(...);
- then replace the gallery with another one
  simpleviewer.reset();
  simpleviewer.load(...);
the only solution seems to be to use iframes.
Where I need a fullscreen button, please... even with a simplified behavior...

Thanks,
Ion

Re: Re-using a SimpleViewer object embedded in a page

We will look into fixing this in the next version.

Have you tried navigating to a new URL from your menu? That way each gallery has it's own URL. If you use a shared 'svcore' folder the gallery files will be cached. Example here: http://www.simpleviewer.net/simpleviewe … /gallery1/

Felix Turner
SimpleViewer Support Team.

Re: Re-using a SimpleViewer object embedded in a page

Thank you, Felix. I'll follow your suggestion.