/**
  * Stream the online event using Electa service
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function streamEvent($id)
 {
     $user = Auth::user();
     $event = $this->eventRepository->findById($id);
     // check if this event has online streaming
     if (!$this->isOnlineEvent($event)) {
         return Redirect::action('EventsController@index')->with('error', trans('general.event_no_stream'));
     }
     // if event is currently going on
     if (!$this->eventRepository->ongoingEvent($event->date_start, $event->date_end)) {
         return Redirect::action('EventsController@show', $id)->with('warning', trans('general.wrong_event_stream_time'));
     }
     // check whether this user subscribed for this and confirmed
     $subscription = $event->subscriptions()->where('user_id', $user->id)->first();
     // find if this user has a subscriptoin
     if (!$subscription) {
         return Redirect::action('EventsController@index')->with('error', trans('general.not_subscribed'));
     }
     // find whether the user is in the confirmed list
     $subscription = $event->subscriptions()->where('user_id', $user->id)->where('status', 'CONFIRMED')->first();
     // If user has a subscription and subscription is not confirmed
     if (!$subscription) {
         return Redirect::action('EventsController@index')->with('error', trans('general.subscription_not_confirmed'));
     }
     // check whether the user has subscribed as online
     if ($subscription->registration_type != 'ONLINE') {
         return Redirect::action('EventsController@index')->with('error', trans('general.subscription_not_online'));
     }
     // stream the event
     if (!$this->getStreamSettings()) {
         return Redirect::action('EventsController@show', $id)->with('info', trans('word.system_error'));
     }
     list($token, $cid, $launchUrl) = $this->getStreamSettings();
     if (is_null($token)) {
         return Redirect::action('EventsController@show', $id)->with('error', trans('word.system-error'));
     }
     // Find the user id
     $userTypeId = $event->isAuthor($user->id) ? 1000 : 0;
     // user date to pass to streaming server
     $data = ['token' => urlencode($token), 'cid' => $cid, 'roomid' => $event->setting->online_room_id, 'usertypeid' => $userTypeId, 'gender' => $user->gender ? $user->gender[0] : 'M', 'firstname' => $user->username, 'lastname' => $user->name, 'email' => $user->email, 'externalname' => $user->username];
     // launch the live stream
     $this->launchStream($data, $launchUrl);
 }