config = Config::getInstance(); $this->container = $container; $session = SessionManager::getSession(); $this->sessionSegment = $session->getSegment(self::class); $this->localeManager = $this->container->get('locale'); if (!$this->config->stream) { // Force HTTP if stream is not enabled. $this->defaultFormat = Config::addHttpToFormat($this->defaultFormat); } } /** * Get video format from request parameters or default format if none is specified. * * @param Request $request PSR-7 request * * @return string format */ protected function getFormat(Request $request) { $format = $request->getQueryParam('format'); if (!isset($format)) { $format = $this->defaultFormat; } return $format; } /** * Get the password entered for the current video. * * @param Request $request PSR-7 request * * @return string Password */ protected function getPassword(Request $request) { $url = $request->getQueryParam('url'); $password = $request->getParam('password'); if (isset($password)) { $this->sessionSegment->setFlash($url, $password); } else { $password = $this->sessionSegment->getFlash($url); } return $password; } }