PHP - CURL: Video Streaming

 
Vista:
Imágen de perfil de Luis
Val: 6
Ha aumentado su posición en 23 puestos en PHP (en relación al último mes)
Gráfica de PHP

CURL: Video Streaming

Publicado por Luis (3 intervenciones) el 23/12/2019 08:46:33
Tengo una url http://38.18.238.99:2095/307CartoonNetwork/transco14/chunk_Auth=ix08x%C2%A0Z6Q7r567Z5%5E@9WxF%C2%A0g7x%C2%A6c=1/chunks.m3u8 que contiene un streaming del tipo m3u8, este streaming solo se puede acceder siempre y cuando el user-agent sea "BrzLRzQgfTrvXYGnfIVrkwb9402QA44LkyZf98xmMznUT".

Mi idea es realizar una petición hacia la url por curl definiendo el user-agent y así poder acceder a el.

Lo que busco al final es poder reproducirlo con la ayuda de la librearía videojs.js: http://videojs.com.

Mi problema es que:
Si coloco en el src la url del streaming original y con la ayuda de el complemento "User-Agent Switcher" : https://addons.mozilla.org/es/firefox/addon/uaswitcher/ para firefox cambiando el user-agent que mencione arriba entonces si me lo reproduce.
Pero si coloco la url de mi archivo con el que realizo la petición curl y dejando el user-agent por defecto ya no.

Estos son los 2 archivos principales.

index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
 
	<title>Get Video Channel User-Agent</title>
 
    <!-- VideoJS || Require JS -->
	<link href="https://vjs.zencdn.net/7.5.5/video-js.css" rel="stylesheet" />
    <link href="css/videojsSkin.css" rel="stylesheet">
</head>
<body>
 
				<video id="video" class="video-js vjs-default-skin col-md-12" width="640px" height="400px" data-setup ='{}' controls preload="none">
					<source src="./video.php" type="application/x-mpegURL">
				</video>
 
	<!-- JQuery 3.3.1 -->
	<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
 
	<!-- VideoJS || Requiere CSS -->
	<script src="https://vjs.zencdn.net/7.5.5/video.js"></script>
	<script src="js/videojsEspanol.js"></script>
 
</body>
</html>

video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$url = "http://38.18.238.99:2095/307CartoonNetwork/transco14/chunk_Auth=ix08x%C2%A0Z6Q7r567Z5%5E@9WxF%C2%A0g7x%C2%A6c=1/chunks.m3u8";
 
$curl = curl_init();
 
curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_USERAGENT => 'BrzLRzQgfTrvXYGnfIVrkwb9402QA44LkyZf98xmMznUT'
]);
 
curl_exec($curl);
curl_close($curl);
 
header('Content-type: application/x-mpegURL');
header("Content-disposition: attachment; filename=chunks.m3u8");

Estoy abierto a sugerencias si es que se les ocurre alguna otra idea de como acceder al streaming.
De antemano gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

CURL: Video Streaming

Publicado por Gustavo (1 intervención) el 15/02/2022 08:18:31
Hola, buen dia, tengo el mismo inconveniente, has podido lograr que funcione?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar