I am close to getting my first application complete, but I have a question about showing videos from album child clicks.
Basically, I have a horizontal album viewer (see picture below). I'd like to have it when a user clicks the play button that a video loads to the right of it. If they click another items play button it would stop and close that video and launch the new video.
Album items are loaded via a RenderKit and the video item is loaded outside of that RenderKit. I have set the play button icon id with data from the renderkit, in effort to provide each play button with a unique ID. Do I need to add an event listener to the code to listen for these ID clicks, then set the video source (via id)?
Or is there a better way to do this? I have also looked at extending the album class, but it seems like that may be overkill for this project.
One solution is to add gesture or touch events to each of the items and enable mouseChildren on the album allowing child interaction. If you do this, you will need to enable clusterBubbling on the album to allow gestures to bubble back up to the parent Album. Another solution is to extend the album, enable mouseChildren, add a single internal touch handler on the album and evaluate the event target. This is the best solution since it relies on a single event listener opposed to one per item.
Great! Thanks! I was able to get this up an running.
One more question. If I load the extended album item by itself it works fine. If I add it via an include to my full application I end up getting a "not responding" screen as it loads. After waiting for 5 minutes or so, the application never loads, it just hangs on the Open Exhibits splash screen. I don't think it's a memory issue as task manager shows 85 MB being used and 26-30% CPU. My development device is the i7 Surface Pro 3.
Here is something else that is weird. If I copy the code via for my extended component and paste it directly into the main.cml, it works. If I do it via an include I get the (not responding) text in the program's title and it never loads. Is there a limit to the number of includes allowed? I currently have 5 items that I'd like to include (background, attract, album, slideshow, and the extended video player I created).
No there is no limit to the number of include tags. However there is a bug introduced with the include variables feature in which the parser reiterates through each include tag resolving attribute assignments and is what's causing the hangup. I have since removed the feature from the development branch so you can either grab that from github or I can link you to an interim swc.
Would you mind posting that link the interim swc?