actualizacion prueba video

parent 07e80ab2
......@@ -124,4 +124,18 @@ ws_notificacion_suscripcion_desinscripcion:
ws_notificacion_cobro:
path: app/ws/notificacion/cobro
controller: App\WsBundle\Controller\wsReceptorVPW::notificacionesCobro
methods: [GET,POST]
\ No newline at end of file
methods: [GET,POST]
test_video:
path: app/video
controller: App\BackendBundle\Controller\Test::video
methods: [GET]
get_video:
path: app/get/media/{key}
controller: App\BackendBundle\Controller\Test::getVideo
requirements:
key: \d+
\ No newline at end of file
<?php
namespace App\BackendBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use App\Utilities\Utiles;
class TestController extends AbstractController {
private $manager = null;
public function video(Request $request): Response {
$this->manager = $this->getDoctrine()->getManager('default');
return $this->render('test/index.html.twig', array());
}
public function getVideo(Request $request): Response {
$id = $request->get("id",null);
//se busca archivo en base al id en la base de datos
//se obtiene la url de este (ubicacion en el disco)
// Generate response
$response = new Response();
$filename = Utiles::getPublicRoot()."/videos/0/video.m3u8";
// Set headers
$response->headers->set('Cache-Control', 'private');
$response->headers->set('Content-type', mime_content_type($filename));
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($filename) . '";');
$response->headers->set('Content-length', filesize($filename));
// Send headers before outputting anything
$response->sendHeaders();
$response->setContent(file_get_contents($filename));
return $response;
}
}
......@@ -29,7 +29,7 @@ class Utiles {
$log->pushHandler($handler);
return $log;
}
public static function isMsisdn($msisdn) {
if (strlen($msisdn) != 9 || !is_numeric($msisdn)) {
return false;
......
<video width="352" height="198" controls>
<source src="{{path('',{'media' : '0908978'})}}" type="application/x-mpegURL">
</video>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment