Example #1
0
 public function handleLiveStreamRequest($liveStreamId)
 {
     $liveStream = LiveStream::showAsLiveStream()->find($liveStreamId);
     if (is_null($liveStream)) {
         $this->do404Response($this->getDisableRedirect());
         return;
     }
     $title = $liveStream->name;
     $playerInfoUri = $this->getLiveStreamInfoUri($liveStream->id);
     $registerWatchingUri = $this->getLiveStreamRegisterWatchingUri($liveStream->id);
     $registerLikeUri = null;
     $adminOverrideEnabled = false;
     $hyperlink = URL::route('liveStream', array($liveStream->id));
     $this->doResponse($title, $playerInfoUri, $registerWatchingUri, $registerLikeUri, $adminOverrideEnabled, $hyperlink);
 }
 public function postRegisterWatching($liveStreamId)
 {
     $liveStream = LiveStream::showAsLiveStream()->find($liveStreamId);
     if (is_null($liveStream)) {
         App::abort(404);
     }
     $success = false;
     if (isset($_POST['playing'])) {
         $playing = $_POST['playing'] === "1";
         $success = $liveStream->registerWatching($playing);
     }
     return Response::json(array("success" => $success));
 }