我有一个php链接,它返回流的url,如下所示: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
?>我会将php链接的结果传递到包含clappr播放器的我的视频页面。如何定义变量src以从脚本中的php响应中获取流链接?我这样做了,但没有工作。
<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>请帮帮我!
发布于 2021-11-01 11:07:38
仅当javascript放在同一文件中时才有效:
<?php $stream = "http://myexample.com/xyz.m3u8?token=xxx"; ?>
var src="<?php echo $stream; ?>";https://stackoverflow.com/questions/69795922
复制相似问题