Пример #1
0
 /**
  * Class constructor
  *
  * @param int $clipId
  */
 public function __construct(array $params)
 {
     parent::__construct();
     $clipId = $params['id'];
     $this->clipService = VWVR_BOL_ClipService::getInstance();
     $clip = $this->clipService->findClipById($clipId);
     $config = OW::getConfig();
     $room_name = $clip->title;
     $params = $clip->recordingId . '^';
     $params .= $clip->description . '^';
     $settings .= $config->getValue('vwvr', 'recordLimit') . '^';
     $settings .= $config->getValue('vwvr', 'camWidth') . '^';
     $settings .= $config->getValue('vwvr', 'camHeight') . '^';
     $settings .= $config->getValue('vwvr', 'camFPS') . '^';
     $settings .= $config->getValue('vwvr', 'micRate') . '^';
     $settings .= $config->getValue('vwvr', 'camBandwidth') . '^';
     $settings .= $config->getValue('vwvr', 'layoutCode') . '^';
     $settings .= $config->getValue('vwvr', 'showCamSettings') . '^';
     $settings .= $config->getValue('vwvr', 'advancedCamSettings') . '^';
     $settings .= $config->getValue('vwvr', 'fillWindow') . '^';
     $settings .= $config->getValue('vwvr', 'server') . '^';
     $settings .= $config->getValue('vwvr', 'serverAMF') . '^';
     $settings .= $config->getValue('vwvr', 'camMaxBandwidth') . '^';
     $settings .= $config->getValue('vwvr', 'bufferLive') . '^';
     $settings .= $config->getValue('vwvr', 'bufferFull') . '^';
     $settings .= $config->getValue('vwvr', 'bufferLivePlayback') . '^';
     $settings .= $config->getValue('vwvr', 'bufferFullPlayback') . '^';
     // room owner
     $idOwner = $clip->userId;
     $usernameOwner = BOL_UserService::getInstance()->getUsername($idOwner);
     $urlRoom = OW::getRouter()->urlForRoute('vwview_list_vr', array('listType' => 'latest'));
     $userId = OW::getUser()->getId();
     // visitor
     $userService = BOL_UserService::getInstance();
     $user = $userService->findUserById($userId);
     if (isset($user)) {
         $username = $user->getUsername();
     } else {
         $username = "******" . base_convert(time() - 1224350000 . rand(0, 10), 10, 36);
     }
     $baseSwfUrl = $config->getValue('vwvr', 'baseSwf_url');
     $srcSwfUrl = $baseSwfUrl . "streamplayer.swf?streamName=" . urlencode($room_name . $clip->recordingId) . "&serverRTMP=" . urlencode($config->getValue('vwvr', 'server')) . "&templateURL=";
     $code = '<embed width="100%" height="450px" scale="noscale" salign="lt" src="' . $srcSwfUrl . '" bgcolor="#777777" base="' . $baseSwfUrl . '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="transparent"></embed>';
     $this->assign('clipCode', $code);
 }
Пример #2
0
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     if (empty($params->additionalParamList['entityId'])) {
         $userId = OW::getUser()->getId();
     } else {
         $userId = $params->additionalParamList['entityId'];
     }
     $friendsIdList = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => OW::getUser()->getId()));
     $count = 25;
     $this->clipService = VWVR_BOL_ClipService::getInstance();
     $clips = $this->clipService->findClipsList('online', '1', $count);
     $friendsCount = count($friendsIdList);
     $result = array();
     $resultx = "";
     foreach ($friendsIdList as $friendId) {
         //          $resultx = $this->clipService->findClipsByFriendId($friendId, $clips);
         if ($resultx != "") {
             array_push($result, $resultx);
         }
     }
     $html = "";
     if ($result != "") {
         foreach ($result as $part) {
             $partx = explode(":", $part);
             $displayName = BOL_UserService::getInstance()->getDisplayName($partx[0]);
             $html .= $displayName . "&nbsp;";
             $active_in = OW::getLanguage()->text('vwvr', 'active_in');
             $html .= $active_in;
             $roomIdx = explode("|", $partx[1]);
             foreach ($roomIdx as $roomId) {
                 $clipx = $this->clipService->findClipById($roomId);
                 $urlRoom = OW::getRouter()->urlForRoute('vwview_clip_vr', array('id' => $roomId));
                 $html .= '&nbsp;<a href ="' . $urlRoom . '">' . $clipx->room_name . '</a>';
             }
             $html .= "<br />";
         }
         $this->assign('content', $html);
         //        $this->assign('content', var_dump ($resultx));
     } else {
         $this->assign('content', OW::getLanguage()->text('vwvr', 'no_active_room'));
     }
 }
Пример #3
0
 /**
  * Deletes vwvr clip
  *
  * @param array $params
  * @return array
  */
 public function ajaxDeleteClip($params)
 {
     $clipId = $params['clipId'];
     $ownerId = $this->clipService->findClipOwner($clipId);
     $isOwner = OW::getUser()->isAuthorized('vwvr', 'add', $ownerId);
     $isModerator = OW::getUser()->isAuthorized('vwvr');
     if (!$isOwner && !$isModerator) {
         throw new Redirect404Exception();
         return;
     }
     // find room_name
     $clipRec = $this->clipService->findClipById($clipId);
     $clipName = $clipRec->title . $clipRec->recordingId;
     if ($clipName) {
         // delete recorded file from recordPath
         $config = OW::getConfig();
         $recordPath = $config->getValue('vwvr', 'recordPath');
         if (file_exists($fileRecordPath = $recordPath . "/" . $clipName . ".flv")) {
             unlink($fileRecordPath);
         }
         if (file_exists($fileRecordPath = $recordPath . "/" . $clipName . ".mp4")) {
             unlink($fileRecordPath);
         }
         // delete recorded file from streams and recordings folder
         $dirname = 'streams';
         if (file_exists('../../' . $dirname)) {
             $dir = '../../' . $dirname;
         } elseif (file_exists('../../../' . $dirname)) {
             $dir = '../../../' . $dirname;
         } elseif (file_exists('../../../../' . $dirname)) {
             $dir = '../../../../' . $dirname;
         } elseif (file_exists('../../../../../' . $dirname)) {
             $dir = '../../../../../' . $dirname;
         } elseif (file_exists('../../../../../../' . $dirname)) {
             $dir = '../../../../../../' . $dirname;
         }
         // $streamsPath = realpath($dir);
         $streamsPath = realpath("../" . $dir);
         // delete file if exists
         if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".flv")) {
             unlink($fileStreamsPath);
         }
         if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".key")) {
             unlink($fileStreamsPath);
         }
         if (file_exists($fileStreamsPath = $streamsPath . "/streams/" . $clipName . ".meta")) {
             unlink($fileStreamsPath);
         }
         // delete file from recordings directory
         if (file_exists($fileRecordings = OW_DIR_ROOT . "ow_plugins/vwvideorecorder/vr/recordings/" . $clipName . ".vwr")) {
             unlink($fileRecordings);
         }
     }
     $delResult = $this->clipService->deleteClip($clipId);
     if ($delResult) {
         $return = array('result' => true, 'msg' => OW::getLanguage()->text('vwvr', 'clip_deleted'), 'url' => OW_Router::getInstance()->urlForRoute('vwvr_vwview_list_vr'));
     } else {
         $return = array('result' => false, 'error' => OW::getLanguage()->text('vwvr', 'clip_not_deleted'));
     }
     return $return;
 }