Marak/buddypond

youtube `onYouTubeIframeAPIReady` events for `MTV` App and `IDC Cable` App youtube should be separated

Marak opened this issue · 3 comments

Marak commented

If you look at the Interdimensional Cable App you'll see it has common onYouTubeIframeAPIReady handler for both MTV and IDC.

This isn't ideal as it bounds the apps closely together and requires that youtube embed happens on App.load defer event. It would be better to completely decouple these apps and have separate onYouTubeIframeAPIReady in each app. This will allow for App.load lazy to work.

Issue now is that Desktop must load youtube embeds on ready. We'd rather not inject youtube unless user double clicks on MTV or IDC icon ( that is the lazy event )

Marak commented

I think the only solution here is to separate youtube into Desktop.youtube App and introduce App.depends_on array to MTV and IDC.

The idea would be if an App.depend_on array has any appNames it will lazy load those as dependencies before App.load is called.

Example:

desktop.mtv.depends_on = ["youtube"];

We can utilize the existing lazy loading code for this so adding depends_on should only require a few lines of code.

If we don't have an approach like this we would need to inject N youtube embed iframes into the Desktop where N is the amount of unique youtube players on the screen.

Marak commented

We've deployed a basic App.depends_on implementation which works well for this. Both App.MTV and App.IDC now both depend on App.VideoPlayer and single youtube API embed.

Will continue to test and review what has been deployed.

Keeping open for now.

Marak commented

This is looking good.

We now can embed youtube links directly into the chat windows and they link to IDC.

Closing.