Error generating "Source: File" php

2

I have a problem when generating a player in php with JwPlayer, the problem is that the player takes the link of my page plus the link where the video is hosted link

To generate the video, the page where it is hosted uses JSON:

$id = $_GET['id'];
$url = "https://webdondesealojaelvideo.com/getpublinkdownload?code=".$id."";
$json = file_get_contents($url);
$json_data = json_decode($json, true);

$host = $json_data["hosts"][0];
$path = $json_data["path"];

and I try to generate the link to the video in the following way:

<script type="text/javascript">
sources: [<?php echo '{file:"' . $host . '' . $path . '",label:"low",type: "video/mp4",default: true}'; ?>],
logo : {file: "",
    link: "",
    hide: true,
    },
    abouttext: "",
    aboutlink: ""
  });
</script>

and the following is generated:

<video src="/mipágina.com/linkdevideo.com/cBZgcAkZEbjaY7ZZZu6GNq7ZQ5ZZawVZkZSbAWZYXZf7ZqZdVZVkZaXZS7ZWkZ37ZKkZnXZg7ZRVZsVZfDhbZFUWPmCQvU54rv1QEOmXIojUjKIsX/video.mp4"></video>

and should generate the following:

<video src="linkdevideo.com/cBZgcAkZEbjaY7ZZZu6GNq7ZQ5ZZawVZkZSbAWZYXZf7ZqZdVZVkZaXZS7ZWkZ37ZKkZnXZg7ZRVZsVZfDhbZFUWPmCQvU54rv1QEOmXIojUjKIsX/video.mp4"></video>

Could you help me solve it?

    
asked by R.13 13.06.2016 в 10:11
source

1 answer

1

You are not using a schema in the link, so the browser understands that it is an internal link.

Try it like this:

$host = 'http://' . $json_data["hosts"][0]; 

to force an http schema,

$host = 'https://' . $json_data["hosts"][0]; 

for one https or

$host = '//' . $json_data["hosts"][0]; 

for a "schema free" link that will use the same schema that the client is currently using.

    
answered by 15.06.2016 / 14:35
source