Dashing widget to play video from Youtube.
- Install Youtube widget
The files youtube.coffee
, youtube.html
and youtube.scss
go in the /widget/youtube
directory.
Otherwise you can install this plugin typing:
dashing install GIST_ID
-
Download JQuery TubePlayer plugin and put
jquery.tubeplayer.min.js
in your /assets/javascripts directory. It gets included automatically. -
Download SWFObject and put
swfobject.js
in your /assets/javascripts directory. It gets included automatically. -
Add the #player span after
gridster
div/ul element in your dashingboard.erb file:
<div class="gridster">
<ul>
...
</ul>
<span data-id="youtube" data-view="Youtube" data-title="youtube" style="padding: 0px"></span>
</div>
- Dashing API
To be able to communicate with the widget we need an API (reasons explained below). Add this block to config.ru
after configure
section:
get '/api/:widget/:command' do
widget = params[:widget]
send_event(widget, params)
200
end
- If you are using Wavegirls widget, do not forget to add
'youtube'
toexcluded_dash_ids
(see additional configuration section for details).
Note: if you are using Github's Hubot, take a look at this script. It provides hubot commands to control youtube widget.
== /api/youtube/show?url={url}
- show video or put it on the playlist if another video is already playing
- url - youtube video link
Example:
curl 'http://localhost:3030/api/youtube/show?url=http%3A//www.youtube.com/watch%3Fv%3D1iWiCen1qlE'
== /api/youtube/next
- play next video
Example:
curl 'http://localhost:3030/api/youtube/next'
== /api/youtube/pause
- pause play
Example:
curl 'http://localhost:3030/api/youtube/pause'
== /api/youtube/play
- resume play
Example:
curl 'http://localhost:3030/api/youtube/play'
== /api/youtube/stop
- stop playing and clear playlist
Example:
curl 'http://localhost:3030/api/youtube/stop'
== /api/youtube/mute
- mute video
Example:
curl 'http://localhost:3030/api/youtube/mute'
== /api/youtube/unmute
- unmute video
Example:
curl 'http://localhost:3030/api/youtube/unmute'
Do you have an example .rb file of this??
I'm pretty new to ruby and dashing and would like to know how I can get a video on my dashboard.