如何在Boonex Dolphin中安装HTML5 Video.js?

时间:2014-10-11 13:31:03

标签: javascript php html5 video boonex-dolphin

目前我正在尝试使用Video.js Source Code 更改我的网站上使用Boonex Dolphin的当前视频播放器,在本质上我想要替换它使用的flash播放器并切换到HTML5,Dolphin使用模块,在这些模块中它们指向特定文件。我不知道哪些文件是天气还是不天气,如果它们是HTML文件或PHP文件,或者在那些文件中需要更改的内容,我有一个大致的想法。我只需要朝着正确的方向前进。

谢谢,如果有人回复,对不起,如果我这是一个错误的地方,或者是否已经被问过(我先搜查过)。

1 个答案:

答案 0 :(得分:-1)

根据帖子here

只需编辑以下文件即可。模块/ boonex / html5av /类/ BxH5avModule.php


在第56行替换此部分代码。

    case STATUS_APPROVED:
        if (file_exists($sFilesPath . $iFileId . M4V_EXTENSION)) {

            $sToken = getToken($iFileId);

            if (file_exists($sFilesPath . $iFileId . '.webm'))
                $sSourceWebm = '<source type=\'video/webm; codecs="vp8, vorbis"\' src="' . BX_DOL_URL_ROOT . "flash/modules/video/get_file.php?id=" . $iFileId . "&ext=webm&token=" . $sToken . '" />';

            $sFlash = getApplicationContent('video','player',array('id' => $iFileId, 'user' => getLoggedId(), 'password' => clear_xss($_COOKIE['memberPassword'])),true);
            $sId = 'bx-media-' . genRndPwd(8, false);
            $sJs = $sSourceWebm ? // if no .webm video available - we need nice fallback in firefox and other browsers with no mp4 support
                    '' : '
                    var eMedia = document.createElement("video");
                    if (eMedia.canPlayType && !eMedia.canPlayType("video/x-m4v")) {
                        var sReplace = "' . bx_js_string(BX_H5AV_FALLBACK ? $sFlash : '<b>Your browser doesn\'t support this media playback.</b>', BX_ESCAPE_STR_QUOTE) . '";
                        $("#' . $sId . '").replaceWith(sReplace);
                    }';
            $sJs .= $aFile['Time'] ? // if length is not set
                    '' : '
                    var eFile = $("#' . $sId . '");
                    eFile.on("canplay", function (e) {
                        $.post("' . BX_DOL_URL_ROOT . 'flash/XML.php", {
                            module: "video",
                            action: "updateFileTime",
                            id: ' . $iFileId . ',
                            time: parseInt(this.duration * 1000)
                        });
                    });';

            $sAutoPlay = TRUE_VAL == getSettingValue('video', 'autoPlay') && class_exists('BxVideosPageView') ? 'autoplay' : '';

            $sFilePoster = 'flash/modules/video/files/' . $iFileId . '.jpg';
            $sPoster = file_exists(BX_DIRECTORY_PATH_ROOT . $sFilePoster) ? ' poster="' . BX_DOL_URL_ROOT . $sFilePoster . '" ' : '';

            $sOverride = '
                <video controls preload="auto" autobuffer ' . $sAutoPlay . $sPoster . ' style="width:100%; height:' . getSettingValue('video', 'player_height') . 'px;" id="' . $sId . '">
                    ' . $sSourceWebm . '
                    <source src="' . BX_DOL_URL_ROOT . "flash/modules/video/get_file.php?id=" . $iFileId . "&ext=m4v&token=" . $sToken . '" />
                    ' . (BX_H5AV_FALLBACK ? $sFlash : '<b>Can not playback media - your browser doesn\'t support HTML5 audio/video tag.</b>') . '
                </video>
                <script>
                    ' . $sJs . '
                </script>';
        break;
        }

用此替换该部分代码。

            case STATUS_APPROVED:
                if (file_exists($sFilesPath . $iFileId . M4V_EXTENSION)) {
                    // Video JS Player
                    $mediaroot  = BX_DOL_URL_ROOT . 'flash/modules/video/files/';
                    $sJs = $aFile['Time'] ? // if length is not set
                            '' : '
                            var eFile = $("#video_' . $iFileId . '");
                            eFile.on("canplay", function (e) {
                                $.post("' . BX_DOL_URL_ROOT . 'flash/XML.php", {
                                    module: "video",
                                    action: "updateFileTime",
                                    id: ' . $iFileId . ',
                                    time: parseInt(this.duration * 1000)
                                });
                            });';
                    $sJs = '<script>' . $sJs . '</script>';
                    $sOverride    = <<<CODE
                      <link href="//vjs.zencdn.net/4.9/video-js.css" rel="stylesheet">
                      <script src="//vjs.zencdn.net/4.9/video.js"></script>
                      <video id="video_{$iFileId}" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="none" width="100%" height="430"
                          poster="{$mediaroot}{$iFileId}.jpg"
                          data-setup="{}">
                        <source src="{$mediaroot}{$iFileId}.m4v" type='video/mp4' />
                        <source src="{$mediaroot}{$iFileId}.webm" type='video/webm' />
                      </video>
                      {$sJs}
CODE;

                    $sOverride = '<div class="viewFile" style="width:100%;">' . $sOverride . '</div>';

                break;
                }