Skip to content

Instantly share code, notes, and snippets.

@romaninsh
Created August 1, 2013 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romaninsh/6132565 to your computer and use it in GitHub Desktop.
Save romaninsh/6132565 to your computer and use it in GitHub Desktop.
<?php
// Add a player and link player's API with a button-click in PHP
$p=$this->add('View_VimeoPlayer');
$this->add('Button')->js('click', $p->vimeo()->api('play'));
class View_VimeoPlayer extends View {
function init(){
parent::init();
$this->api->jquery->addStaticInclude('//a.vimeocdn.com/js/froogaloop2.min.js');
$this->js(true,'window['.json_encode($this->getJSID()).
'] = $f($("#'.$this->getJSID().
'")[0]);');
}
/**
* provides access to vimeo player API
* http://developer.vimeo.com/player/js-api
*/
function vimeo(){
return $this->api->js()->_library('window['.json_encode($this->getJSID()).']');
}
}
@romaninsh
Copy link
Author

takes advantage of this commit: atk4/atk4@8f017a2

@DarkSide666
Copy link

looks very interesting and definitely it's new opportunity for some nice ATK add-ons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment