|
@@ 9-29 (lines=21) @@
|
| 6 |
|
use Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\CodeDefinition; |
| 7 |
|
|
| 8 |
|
//@codingStandardsIgnoreStart |
| 9 |
|
class Html5Audio extends CodeDefinition |
| 10 |
|
//@codingStandardsIgnoreEnd |
| 11 |
|
{ |
| 12 |
|
use UrlParserTrait; |
| 13 |
|
|
| 14 |
|
protected $_sTagName = 'audio'; |
| 15 |
|
|
| 16 |
|
protected $_sParseContent = false; |
| 17 |
|
|
| 18 |
|
/** |
| 19 |
|
* {@inheritDoc} |
| 20 |
|
*/ |
| 21 |
|
protected function _parse($content, $attributes, \JBBCode\ElementNode $node) |
| 22 |
|
{ |
| 23 |
|
if (!empty($attributes['src']) && $attributes['src'] === 'upload') { |
| 24 |
|
$content = $this->_linkToUploadedFile($content); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
// Better: preload='metadata'. But Safari 12 doesn't support it. |
| 28 |
|
return "<audio src='$content' controls='controls' preload='auto' x-webkit-airplay='allow'></audio>"; |
| 29 |
|
} |
| 30 |
|
} |
| 31 |
|
|
| 32 |
|
//@codingStandardsIgnoreStart |
|
@@ 40-60 (lines=21) @@
|
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
//@codingStandardsIgnoreStart |
| 40 |
|
class Html5Video extends CodeDefinition |
| 41 |
|
//@codingStandardsIgnoreEnd |
| 42 |
|
{ |
| 43 |
|
use UrlParserTrait; |
| 44 |
|
|
| 45 |
|
protected $_sTagName = 'video'; |
| 46 |
|
|
| 47 |
|
protected $_sParseContent = false; |
| 48 |
|
|
| 49 |
|
/** |
| 50 |
|
* {@inheritDoc} |
| 51 |
|
*/ |
| 52 |
|
protected function _parse($content, $attributes, \JBBCode\ElementNode $node) |
| 53 |
|
{ |
| 54 |
|
if (!empty($attributes['src']) && $attributes['src'] === 'upload') { |
| 55 |
|
$content = $this->_linkToUploadedFile($content); |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
// Better: preload='metadata'. But Safari 12 doesn't support it and |
| 59 |
|
// only shows a blank preview. |
| 60 |
|
return "<video src='$content' controls='controls' preload='auto' x-webkit-airplay='allow'></video>"; |
| 61 |
|
} |
| 62 |
|
} |
| 63 |
|
|