Skip to content
This repository was archived by the owner on Feb 13, 2021. It is now read-only.

Example: Open Preview Dialog

PlugLynn edited this page Apr 18, 2015 · 2 revisions

The Preview Dialog is a simple dialog with a YouTube or SoundCloud video embedded.

Code

varEvents=plugModules.require('plug/core/Events')varPreviewEvent=plugModules.require('plug/events/PreviewEvent')functionshowPreview(media){// The PreviewEvent expects a Media model, but any Backbone Model instance will work,// and creating a Model instance is easier than creating a Media instance.media=newBackbone.Model(media)Events.dispatch(newPreviewEvent(PreviewEvent.PREVIEW,media))}

Usage

showPreview({format: 1,// 1 for YouTube, 2 for SoundCloudcid: '',// YouTube or SoundCloud video ID, e.g. "e2rexvDHPZs"author: 'Artist Name',title: 'Song Name'})

Clone this wiki locally