예제 #1
0
 public function entryReplay($lessonId, $courseLessonReplayId)
 {
     $lesson = $this->getLessonDao()->getLesson($lessonId);
     list($course, $member) = $this->tryTakeCourse($lesson['courseId']);
     $courseLessonReplay = $this->getCourseLessonReplayDao()->getCourseLessonReplay($courseLessonReplayId);
     $user = $this->getCurrentUser();
     $args = array('liveId' => $lesson["mediaId"], 'replayId' => $courseLessonReplay["replayId"], 'provider' => $lesson["liveProvider"], 'user' => $user['email'], 'nickname' => $user['nickname']);
     $client = new EdusohoLiveClient();
     $result = $client->entryReplay($args);
     return $result;
 }
예제 #2
0
 public function getLiveCourse()
 {
     $user = $this->controller->getUserByToken($this->request);
     if (!$user->isLogin()) {
         return $this->createErrorResponse('not_login', "您尚未登录!");
     }
     $courseId = $this->getParam("courseId", 0);
     $lessonId = $this->getParam("lessonId", 0);
     $lesson = $this->controller->getCourseService()->getCourseLesson($courseId, $lessonId);
     $now = time();
     $params = array();
     $params['email'] = 'live-' . $user['id'] . '@edusoho.net';
     $params['nickname'] = $user['nickname'];
     $params['sign'] = "c{$lesson['courseId']}u{$user['id']}t{$now}";
     $params['sign'] .= 's' . $this->makeSign($params['sign']);
     $params['liveId'] = $lesson['mediaId'];
     $params['provider'] = $lesson["liveProvider"];
     $params['role'] = 'student';
     $params['user'] = $params['email'];
     $client = new EdusohoLiveClient();
     if (isset($lesson['replayStatus']) && $lesson['replayStatus'] == 'generated') {
         $result = $client->entryReplay($params, 'root');
     } else {
         $result = $client->getRoomUrl($params, 'root');
     }
     return array('data' => array('lesson' => $lesson, 'result' => $result));
 }