Go to the documentation of this file.
10 define(
'CH_H5AV_FALLBACK',
true);
12 define(
'CH_H5AV_VIDEO_EMBED_HEIGHT', 315);
13 define(
'CH_H5AV_VIDEO_EMBED_WIDTH', 560);
15 define(
'CH_H5AV_AUDIO_EMBED_HEIGHT', 54);
16 define(
'CH_H5AV_AUDIO_EMBED_WIDTH', 560);
29 echo $this->_oTemplate->parseHtmlByName(
'embed.html', array(
31 'ch_if:message' => array(
32 'condition' => !(
bool)$sPlayer,
33 'content' => array(
'message' =>
$sMessage),
41 echo $this->_oTemplate->parseHtmlByName(
'embed.html', array(
43 'ch_if:message' => array(
44 'condition' => !(
bool)$sPlayer,
45 'content' => array(
'message' =>
$sMessage),
71 if (!($aFile = $this->_oDb->getRow(
"SELECT * FROM `RayVideoFiles` WHERE `ID` = ?", [
$iFileId])))
74 if (
"" == $aFile[
'Source']) {
95 $oAlert->aExtras[
'override'] = ($sPlayer ? $sPlayer : $this->_oTemplate->addCss(array(
'default.css',
'common.css',
'general.css'),
true) .
MsgBox(
$sMessage));
102 if (!($aFile = $this->_oDb->getRow(
"SELECT * FROM `RayVideoFiles` WHERE `ID` = ?", [
$iFileId])))
103 return array(
false,
_t(
'_sys_media_not_found'));
122 $aRet = array(
false,
false);
123 switch($aFile[
'Status']) {
125 case STATUS_PROCESSING:
126 $aRet = array(
false,
_t(
'_sys_media_processing'));
128 case STATUS_DISAPPROVED:
130 $aRet = array(
false,
_t(
'_sys_media_disapproved'));
133 case STATUS_APPROVED:
139 $sSourceWebm =
'<source type=\'video/webm; codecs="vp8, vorbis"\' src="' . CH_WSB_URL_ROOT .
"flash/modules/video/get_file.php?id=" .
$iFileId .
"&ext=webm&token=" .
$sToken .
'" />';
143 $sJs = $sSourceWebm ?
145 var eMedia = document.createElement("video");
146 if (eMedia.canPlayType && !eMedia.canPlayType("video/x-m4v")) {
148 $("#' .
$sId .
'").replaceWith(sReplace);
150 $sJs .= $aFile[
'Time'] ?
152 eFile.on("canplay", function (e) {
153 $.post("' . CH_WSB_URL_ROOT .
'flash/XML.php", {
155 action: "updateFileTime",
157 time: parseInt(this.duration * 1000)
161 $sAutoPlay = $bEnableAutoplay && TRUE_VAL ==
getSettingValue(
'video',
'autoPlay') && class_exists(
'ChVideosPageView') ?
'autoplay' :
'';
163 $sFilePoster =
'flash/modules/video/files/' .
$iFileId .
'.jpg';
164 $sPoster = file_exists(CH_DIRECTORY_PATH_ROOT . $sFilePoster) ?
' poster="' . CH_WSB_URL_ROOT . $sFilePoster .
'" ' :
'';
166 $sStyleMaxHeight = $bSetMaxHeight ?
'max-height:' .
getSettingValue(
'video',
'player_height') .
'px;' :
'';
169 <video controls preload="metadata" autobuffer ' . $sAutoPlay . $sPoster .
' style="width:100%;' . $sStyleMaxHeight . $sCustomStyles .
'" id="' .
$sId .
'">
171 <source src="' . CH_WSB_URL_ROOT .
"flash/modules/video/get_file.php?id=" .
$iFileId .
"&ext=m4v&token=" .
$sToken .
'" />
172 ' . (
CH_H5AV_FALLBACK ? $sFlash :
'<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') .
'
175 var eFile = $("#' .
$sId .
'");
176 eFile.on("play", function () {
178 $("video").each(function () {
179 if (this != ePlaying)
185 $aRet = array($sPlayer,
'');
191 $aRet = array(
false,
_t(
'_sys_media_not_found'));
207 if (!
$oAlert->aExtras[
'result'])
211 $sTempFile =
$oAlert->aExtras[
'tmp_file'];
212 $iBitrate =
$oAlert->aExtras[
'bitrate'];
213 $sSize =
$oAlert->aExtras[
'size'];
214 $sPlayFile = $sTempFile .
'.webm';
216 if (!file_exists($sTempFile))
217 $sTempFile .=
'.flv';
219 $sCommand =
$sFfmpegPath .
" -y -i " . $sTempFile .
" -acodec libvorbis -b:a 128k -ar 44100 -b:v {$iBitrate}k -s {$sSize} " . $sPlayFile;
220 popen($sCommand,
"r");
235 @unlink($oMain->_oConfig->getFilesPath() .
$iFileId .
'.webm');
251 $oAlert->aExtras[
'override'] = ($sPlayer ? $sPlayer : $this->_oTemplate->addCss(array(
'default.css',
'common.css',
'general.css'),
true) .
MsgBox(
$sMessage));
258 if (!($aFile = $this->_oDb->getRow(
"SELECT * FROM `RayMp3Files` WHERE `ID` = ?", [
$iFileId])))
259 return array(
false,
_t(
'_sys_media_not_found'));
279 $aRet = array(
false,
false);
280 switch($aFile[
'Status']) {
282 case STATUS_PROCESSING:
283 $aRet = array(
false,
_t(
'_sys_media_processing'));
285 case STATUS_DISAPPROVED:
287 $aRet = array(
false,
_t(
'_sys_media_disapproved'));
290 case STATUS_APPROVED:
296 $sSourceOgg =
'<source type=\'audio/ogg; codecs="vorbis"\' src="' . CH_WSB_URL_ROOT .
"flash/modules/mp3/get_file.php?id=" .
$iFileId .
"&token=" .
$sToken .
'&ext=ogg" />';
302 var eMedia = document.createElement("audio");
303 if (eMedia.canPlayType && !eMedia.canPlayType("audio/mpeg")) {
305 $("#' .
$sId .
'").replaceWith(sReplace);
307 $sJs .= $aFile[
'Time'] ?
309 eFile.on("canplay", function (e) {
310 $.post("' . CH_WSB_URL_ROOT .
'flash/XML.php", {
312 action: "updateFileTime",
314 time: parseInt(this.duration * 1000)
317 $sAutoPlay = $bEnableAutoplay && TRUE_VAL ==
getSettingValue(
'mp3',
'autoPlay') && class_exists(
'ChSoundsPageView') ?
'autoplay' :
'';
319 <audio controls ' . $sAutoPlay .
' preload="metadata" autobuffer style="width:100%; ' . $sCustomStyles .
'" id="' .
$sId .
'">
320 <source type=\'audio/mpeg; codecs="mp3"\' src="' . CH_WSB_URL_ROOT .
"flash/modules/mp3/get_file.php?id=" .
$iFileId .
"&token=" .
$sToken .
'" />
322 ' . (
CH_H5AV_FALLBACK ? $sFlash :
'<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') .
'
325 var eFile = $("#' .
$sId .
'");
326 eFile.on("play", function () {
328 $("audio").each(function () {
329 if (this != ePlaying)
335 $aRet = array($sPlayer,
'');
340 $aRet = array(
false,
_t(
'_sys_media_not_found'));
355 if (!
$oAlert->aExtras[
'result'])
359 $sTempFile =
$oAlert->aExtras[
'tmp_file'];
360 $iBitrate =
$oAlert->aExtras[
'bitrate'];
361 $sPlayFile = $sTempFile .
'.ogg';
363 $sCommand =
$sFfmpegPath .
" -y -i " . $sTempFile . MP3_EXTENSION .
" -vn -b:a " . $iBitrate .
"k -acodec libvorbis " . $sPlayFile;
364 popen($sCommand,
"r");
379 @unlink($oMain->_oConfig->getFilesPath() .
$iFileId .
'.ogg');
392 if (!($aFile = $this->_oDb->getRow(
"SELECT * FROM `RayVideo_commentsFiles` WHERE `ID` = ?", [
$iFileId])))
412 switch($aFile[
'Status']) {
413 case VC_STATUS_DISAPPROVED:
414 $sOverride = $this->_oTemplate->addCss(array(
'default.css',
'common.css',
'general.css'),
true) .
MsgBox(
_t(
'_sys_media_disapproved'));
416 case VC_STATUS_PENDING:
417 case VC_STATUS_PROCESSING:
418 $sOverride = $this->_oTemplate->addCss(array(
'default.css',
'common.css',
'general.css'),
true) .
MsgBox(
_t(
'_sys_media_processing'));
420 case VC_STATUS_APPROVED:
426 $sSourceWebm =
'<source type=\'video/webm; codecs="vp8, vorbis"\' src="' . CH_WSB_URL_ROOT .
"flash/modules/video_comments/get_file.php?id=" .
$iFileId .
"&ext=webm&token=" .
$sToken .
'" />';
428 $sFlash =
$oAlert->aExtras[
'data'];
431 <video controls preload="metadata" autobuffer id="' .
$sId .
'">
433 <source src="' . CH_WSB_URL_ROOT .
"flash/modules/video_comments/get_file.php?id=" .
$iFileId .
"&ext=m4v&token=" .
$sToken .
'" />
434 ' . (
CH_H5AV_FALLBACK ? $sFlash :
'<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') .
'
439 var eMedia = document.createElement("video");
440 if (eMedia.canPlayType && !eMedia.canPlayType("video/x-m4v")) {
442 $("#' .
$sId .
'").replaceWith(sReplace);
447 case VC_STATUS_FAILED:
450 $sOverride = $this->_oTemplate->addCss(array(
'default.css',
'common.css',
'general.css'),
true) .
MsgBox(
_t(
'_sys_media_not_found'));
455 $oAlert->aExtras[
'data'] = $sOverride;
469 if (!
$oAlert->aExtras[
'result'])
473 $sTempFile =
$oAlert->aExtras[
'tmp_file'];
474 $iBitrate =
$oAlert->aExtras[
'bitrate'];
475 $sSize =
$oAlert->aExtras[
'size'];
476 $sPlayFile = $sTempFile .
'.webm';
478 $sCommand =
$sFfmpegPath .
" -y -i " . $sTempFile .
" -acodec libvorbis -b:a 128k -ar 44100 -b:v {$iBitrate}k -s {$sSize} " . $sPlayFile;
479 popen($sCommand,
"r");
const CH_H5AV_VIDEO_EMBED_HEIGHT
const CH_H5AV_AUDIO_EMBED_WIDTH
actionAudioEmbed($iFileId=0)
MsgBox($sText, $iTimer=0)
static getInstance($sClassName)
ch_js_string($mixedInput, $iQuoteType=CH_ESCAPE_STR_AUTO)
serviceResponseCmtsPlayer($oAlert)
serviceResponseVideoConvert($oAlert)
ch_import($sClassName, $aModule=array())
serviceResponseVideoDelete($oAlert)
if(!file_exists($sRayHeaderPath)) $sModule
serviceResponseAudioPlayer($oAlert)
actionVideoEmbed($iFileId=0)
serviceResponseCmtsConvert($oAlert)
serviceResponseAudioEmbed($oAlert)
serviceResponseAudioConvert($oAlert)
const CH_ESCAPE_STR_QUOTE
escape quotes only, for js strings enclosed in quotes, for use in
genRndPwd($iLength=8, $bSpecialCharacters=true)
_t($key, $arg0="", $arg1="", $arg2="")
getApplicationContent($sModule, $sApp, $aParamValues=array(), $bInline=false, $bEmbedCode=false, $sHtmlId="")
getAudioPlayer($iFileId, $bEnableAutoplay=true, $sCustomStyles='')
getVideoPlayer($iFileId, $bEnableAutoplay=true, $bSetMaxHeight=true, $sCustomStyles='')
serviceResponseCmtsDelete($oAlert)
serviceResponseVideoEmbed($oAlert)
getSettingValue($sWidget, $sSettingKey, $sFile="config", $bFullReturn=false, $sFolder="xml")
const CH_H5AV_AUDIO_EMBED_HEIGHT
Attr AllowedRel this is empty
serviceResponseAudioDelete($oAlert)
serviceResponseVideoPlayer($oAlert)
const CH_H5AV_VIDEO_EMBED_WIDTH