4 * Class Video controls video items handling: watching, commenting, rating,
8 * @author Călin-Andrei Burloiu
10 class Video extends CI_Controller {
12 public function __construct()
14 parent::__construct();
16 //$this->lang->load('video');
19 public function index()
25 * The page used for watching a video
27 * @param string $id DB id of the video
28 * @param string $name `name` of the video from DB
29 * @param string $plugin video plugin ('ns-vlc', 'ns-html5'). If it's set
30 * to NULL or 'auto', the plugin is automatically selected.
32 public function watch($id, $name = NULL, $plugin = NULL)
34 $this->load->helper('url');
39 // Retrieve video information.
40 $this->load->model('videos_model');
41 $data['video'] = $this->videos_model->get_video($id, $name);
42 $data['plugin_type'] = ($plugin === NULL ? 'auto' : $plugin);
45 $params = array( 'title' => $data['video']['title'] . ' -- '
46 . $this->config->item('site_name'),
48 'jquery.ui.nsvideo.css',
52 'jquery.ui.nsvideo.js'
54 //'metas' => array('description'=>'','keywords'=>'')
56 $this->load->library('html_head_params', $params);
58 // Preloading video plugin.
59 // TODO plugin auto: type and format
60 if ($data['plugin_type'] == 'auto')
61 $data['plugin_type'] = 'ns-html5';
62 $data['asset_index'] = 0;
64 // TODO remove old AJAX plugin content
65 // $data['plugin_content'] = $this->_plugin('ns-html5',
66 // $data['video']['url'][0], TRUE);
71 $this->load->view('html_begin', $this->html_head_params);
72 $this->load->view('header');
74 //$main_params['content'] = $this->load->view('video/watch_view', $data, TRUE);
75 $this->load->view('video/watch_view', $data);
77 $this->load->view('footer');
78 $this->load->view('html_end');
82 * AJAX page which retrieves a video plugin.
84 * The view associated with this controller should be parameter type
85 * concatenated with '_plugin_view' and must be located in
86 * 'application/views/video'.
88 * @param string $type 'ns-vlc', 'ns-html5'
90 public function plugin($type)
92 $url = $this->input->post('url', TRUE);
94 $this->_plugin($type, $url);
98 * Video plugin controller
100 * See plugin function for details. If the second parameter is TRUE
101 * the output is return instead of being displayed (used in preloading).
103 public function _plugin($type, $url, $return_output=FALSE)
105 if ($type == 'ns-html5')
106 $data['url'] = 'tribe://' . $url;
107 else if ($type == 'ns-vlc')
110 $output = $this->load->view('video/'. $type . '_plugin_view', $data,
119 /* End of file video.php */
120 /* Location: ./application/controllers/video.php */