0

currently I am trying to use the Video.js Source Code to change the current video player on my website that uses Boonex Dolphin, in essense I want to replace the flash player it uses and switch to HTML5, Dolphin uses modules and in those modules they point to specific files. I don't know which files weather or no if they are HTML files or PHP files or where in those files what I need to change, I have a general idea though. I just need to be put in the correct direction.

Thanks if someone reply's, sorry if I this is the wrong place to ask or if it already has been asked ( I searched first).

Khailz
  • 89
  • 1
  • 12

1 Answers1

-1

According to an post here

Just edit the following file. modules/boonex/html5av/classes/BxH5avModule.php


Replace this section of code at line 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;
        }

Replace that section of code with this.

            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;
                }
Khailz
  • 89
  • 1
  • 12