Since I've read that Chrome is having trouble looping an HTML5 video if the response code isn't 206, I'd like to render my template with a 206 code.
Yet I've not found anywhere how to specify an html code when rendering a template... Did anyone already tried that and succeeded ?
In the controller you can create and return a Response object with the content and the specified return code, as example:
return new Response(
$this->renderView('AcmeDemoBundle:Default:video.html.twig', array(
'param1' => $param1,
'param2' => $param2,
)),
206 // return code
);
Hope this help
You can pass a response object with your renderResponse that has the necessary status code.
$response = new Response('', 206);
return $this->renderResponse(
// Or return $this->container->get('templating')
'AcmeBundle:Video:show.html.twig',
array('video' => video),
$response
);
If you do not pass in a Response
with your renderResponse one will be generated automatically. If you pass one then it's content is just set to that of the rendered template (as you can see in the code)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With