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