controllers/DownloadController.php
private function getConvertedResponse(Request $request, Response $response)
    {
        $response = $response->withHeader(
            'Content-Disposition',
            'attachment; filename="'.
            $this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"'
        );
        $response = $response->withHeader('Content-Type', 'video/'.$request->getQueryParam('customFormat'));

        if ($request->isGet() || $request->isPost()) {
            $process = $this->video->getConvertedStream(
                $request->getQueryParam('customBitrate'),
                $request->getQueryParam('customFormat')
            );
            $response = $response->withBody(new Stream($process));
        }

        return $response;
    }
private function getConvertedResponse(Request $request, Response $response)
    {
        $response = $response->withHeader(
            'Content-Disposition',
            'attachment; filename="'.
            $this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"'
        );
        $response = $response->withHeader('Content-Type', 'video/'.$request->getQueryParam('customFormat'));

        if ($request->isGet() || $request->isPost()) {
            $process = $this->video->getConvertedStream(
                $request->getQueryParam('customBitrate'),
                $request->getQueryParam('customFormat')
            );
            $response = $response->withBody(new Stream($process));
        }

        return $response;
    }
private function getConvertedResponse ( Request $ request , Response $ response ) { $ response = $ response -> withHeader ( 'Content-Disposition' , 'attachment; filename="' . $ this -> video -> getFileNameWithExtension ( $ request -> getQueryParam ( 'customFormat' ) ) . '"' ) ; $ response = $ response -> withHeader ( 'Content-Type' , 'video/' . $ request -> getQueryParam ( 'customFormat' ) ) ; if ( $ request -> isGet ( ) || $ request -> isPost ( ) ) { $ process = $ this -> video -> getConvertedStream ( $ request -> getQueryParam ( 'customBitrate' ) , $ request -> getQueryParam ( 'customFormat' ) ) ; $ response = $ response -> withBody ( new Stream ( $ process ) ) ; } return $ response ; }
Return a converted video file.

@param Request  $request  PSR-7 request
@param Response $response PSR-7 response

@return Response HTTP response
Return a converted video file .