1: <?php
2: /**
3: * This file contains the cHTMLVideo class.
4: *
5: * @package Core
6: * @subpackage GUI_HTML
7: * @version SVN Revision $Rev:$
8: *
9: * @author Simon Sprankel
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: /**
19: * cHTMLVideo class represents a video.
20: *
21: * @package Core
22: * @subpackage GUI_HTML
23: */
24: class cHTMLVideo extends cHTMLContentElement {
25:
26: public function __construct($content = '', $class = '', $id = '', $src = '') {
27: parent::__construct($content, $class, $id);
28: $this->_tag = 'video';
29: $this->setSrc($src);
30: }
31:
32: /**
33: * Sets the src attribute of this element.
34: *
35: * @param string $src
36: */
37: public function setSrc($src) {
38: $this->setAttribute('src', $src);
39: }
40:
41: /**
42: * Sets the autoplay attribute which specifies if the sound should be played
43: * automatically.
44: *
45: * @param bool $autoplay
46: */
47: public function setAutoplay($autoplay) {
48: if ($autoplay) {
49: $this->setAttribute('autoplay', 'autoplay');
50: } else {
51: $this->removeAttribute('autoplay');
52: }
53: }
54:
55: /**
56: * Sets the controls attribute which specifies if controls should be shown
57: * in the player.
58: *
59: * @param bool $controls
60: */
61: public function setControls($controls) {
62: if ($controls) {
63: $this->setAttribute('controls', 'controls');
64: } else {
65: $this->removeAttribute('controls');
66: }
67: }
68:
69: /**
70: * Specifies a link to a poster which is shown until the user plays or seeks
71: * the video.
72: *
73: * @param string $poster
74: */
75: public function setPoster($poster) {
76: $this->setAttribute('poster', $poster);
77: }
78:
79: }
80: