Reputation: 1
I have a php link that return the url of stream like this: https://myexample.com/test.php?id=xyz
<?php
//declare some headers and variables
$_GET["id"];
//Do some curl here
$stream = $result;
echo $stream; //http://myexample.com/xyz.m3u8?token=xxx
?>
I would to pass the result of the php link to the my video page that contain clappr player. How do I define the variable src to get the stream link from the php response in the script? I did this way but not working.
<div id="player">
</div>
<script>
var src="https://myexample.com/test.php?id=xyz";
var player = new Clappr.Player({source: src,
autoPlay: true,
height: 360,
width: '100%',
parentId: "#player"
});
</script>
Please help!
Upvotes: 0
Views: 762
Reputation: 1
This will work only if javascript is placed in the same file:
<?php $stream = "http://myexample.com/xyz.m3u8?token=xxx"; ?>
var src="<?php echo $stream; ?>";
Upvotes: -1