Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

php inside soucer file

I have this simple php code that works fine:
srand((float) microtime() * 1971);
$input = array("", "", "", "");
$rand_keys = array_rand($input, 2);
$mixupa = $input[$rand_keys[0]] . "\n";
echo $mixupa

It just random and get one of the 3 youtube links and attrib to $mixupa
this part works fine

the problem is to make $mixupa run in JWPlayer source file

I'm trying this

<script type="text/javascript">jwplayer("PM").setup({sources: [{
file:"'<?php $mixupa ?>'",label:"LEG 360p","type":"mp4"}],logo: {
file: "",link: "", hide: "true"},autostart: "false",width: "100%",height: "85%",
tracks: [{file: "/Filmes/novojw.vtt",label: "PT-BR",kind: "captions", default: "true",}],
captions: {color: "#FFFF00",fontSize: 18,edgeStyle: "uniform",backgroundOpacity: 0,},aboutlink:"",abouttext:"ApertaPlay"});

already tried "<?php $mixupa ?>" , '<?php $mixupa ?>' , "'<?php echo $mixupa; ?>'" etc

I wondering if I must have some .js script to allow jwplayer to run php code?

2 Community Answers


0 rated :

I just figure out that actually the JWPlayer part is ok, if I attrib a direct link to $mixupa, it works using "<?php $mixupa; ?>.

So the problem is make result of php $mixupa work in jwplayer, any ideas?


JW Player Support Agent  
0 rated :

PHP is modifying the Javascript code in your HTML document before it is send to the viewer’s web browser, so you need to make sure you have the correct PHP syntax:


print "
<div id='player'></div>
	file: ''


This question has received the maximum number of answers.