Is there a correct way to implement NextPageObject’s into PhotoAlbums?
I’m posting this because some clients work really nicely and others do not. Also there are very few examples of Photo channels, and the ones that exist are very basic in their functionality.
I have a channel that gets n photos from an api per request. Ideally you would want to have an entry point like “View Gallery”, which takes you to the first batch of images. If you add a bunch of PhotoObjects to the container then add a NextPageObject, you get inconsistent behaviour across different clients.
basic code:
def Page(page=1):
oc = ObjectContainer()
images = JSON.ObjectFromURL(url + page)
for image in images:
oc.add(PhotoObject(
url=image['url']
))
if len(oc) >= imagesPerPage:
oc.add(NextPageObject(
key=Callback(Page, page=page+1)
))
return oc
How clients react (at the time of posting):
- Android: With the above setup, you will get a nice, infinitely scrolling list of thumbnails. I assume this is how this is intended to work. The issue with android here is if you enter a slideshow from a thumbnail that was loaded through the NextPageObject, it just loads the very first image of the directory.
- Plex for Windows: The same behaviour as on Android. You get nice, infinite scrolling thumbnails. But going into the slideshow at an image that was loaded from the NextPageObject loads the very first item in the directory.
- Plex Home Theater: Browsing the thumbnails works fine, it isn’t an infinitely scrolling list, but you get the NextPageObject as you would expect, which takes you to more thumbnails. This doesn’t work though because if you enter a slideshow by clicking on a thumbnail, PHT goes into an infinite loop of resolving the NextPageObjects and you have to kill the server to stop it spamming api requests.
- iOS v4: the current iOS works pretty well. There is no infinite scrolling, but you do get the ‘Next…’ button after the set of images. And unlike PHT, if you enter a slideshow you don’t get an infinite loop. Of course the current iOS has no thumbnails in channels which makes it mostly useless.
- iOS v3 (old): The old iOS client had both infinite scrolling like android, and the images further down that were loaded via NextPageObject would open correctly in the slideshow. (I think it worked, it’s been a while since I used it)
- Plex Web: Plex web works fine. You get a page of image thumbnails and the ‘Next…’ button. Entering a slideshow doesn’t cause any problems.
So I guess it comes down to:
- Should a NextPageObject be in a PhotoAlbum? or should you have a DirectoryObject which links you to separate albums for Page 1, Page 2, etc.
[Page 1, Page 2, Page 3, nextPage] -> Page x: [photo,photo]vs[Gallery] -> [photo, photo, photo, ..., nextPage]. - is Plex Home Theaters infinite loop a bug? Or is this not the way it is expecting photo channels to work?
- is Android and Plex for Windows inability to open images past the first set in its infinite scrolling a bug? Or is this not the way it is expecting photo channels to work?
- A lot of this stuff is undocumented, and I have it working successfully on some clients. Which client can channel developers actually trust to have channel related things implemented the ‘correct way’?