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