X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fcontrollers%2Fvideo.php;h=64a1e63f24b457ef7d75de39fc8ba344d60109b0;hb=a4b67ff4aaa76dc95e774be78724909193999ee4;hp=9a910e0211c3213ab434495233e0bbd5745cccad;hpb=0b134deb6f1108155973436e3de7296a76a2d660;p=living-lab-site.git diff --git a/application/controllers/video.php b/application/controllers/video.php index 9a910e0..64a1e63 100644 --- a/application/controllers/video.php +++ b/application/controllers/video.php @@ -8,29 +8,66 @@ * @author Călin-Andrei Burloiu */ class Video extends CI_Controller { + + public function __construct() + { + parent::__construct(); + } public function index() { } - public function watch($id, $name = NULL) + /** + * The page used for watching a video + * + * @param string $id DB id of the video + * @param string $name `name` of the video from DB + * @param string $plugin video plugin ('ns-vlc', 'ns-html5'). If it's set + * to NULL or 'auto', the plugin is automatically selected. + */ + public function watch($id, $name = NULL, $plugin = NULL) { $this->load->helper('url'); - $this->load->view('html_begin'); - $this->load->view('header'); - + // Retrieve video information. $this->load->model('videos_model'); - $data['video'] = $this->videos_model->getVideo($id)->row(); - if ($name !== NULL && $data['video']->name != $name) - $data['video']->err = 'INVALID_NAME'; + $data['video'] = $this->videos_model->get_video($id, $name); + $data['plugin'] = ($plugin === NULL ? 'auto' : $plugin); + + // Display page. + $params = array( 'title' => $data['video']['title'] . ' -- ' + . $this->config->item('site_name'), + 'stylesheets' => array('jquery-ui.css', 'NextShare_VLC_plugin.css'), + 'javascripts' => array('jquery.min.js', 'jquery-ui.min.js', 'NextShare_VLC_plugin.js', 'video.js'), + //'metas' => array('description'=>'','keywords'=>'') + ); + $this->load->library('html_head_params', $params); + $this->load->view('html_begin', $this->html_head_params); + $this->load->view('header'); $this->load->view('video/watch_view', $data); $this->load->view('footer'); $this->load->view('html_end'); } + + /** + * AJAX page which retrieves a video plugin. + * + * The associated with this controller should be parameter type + * concatenated with '_plugin_view' and must be located in + * 'application/views/video'. + * + * @param string $type 'ns-vlc', 'ns-html5' + */ + public function plugin($type) + { + $data['url'] = $this->input->post('url', TRUE); + + $this->load->view('video/'. $type . '_plugin_view', $data); + } } /* End of file video.php */