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:
<?php
srand((float) microtime() * 1971);
$input = array("https://www.youtube.com/watch?v=w2G5oim2mYM", "https://www.youtube.com/watch?v=TrR5RGSNrxo", "https://www.youtube.com/watch?v=9wKCc0hcieU", "https://www.youtube.com/watch?v=4_C4BDM2PA0");
$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: "http://www.apertaplay.com/assets/uploads/images/Fnl76oLANN.png",link: "http://www.apertaplay.com", 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:"http://www.apertaplay.com",abouttext:"ApertaPlay"});
</script>

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

Anulador

User  
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?

Todd

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:

<php

print "
<div id='player'></div>
<script>
jwplayer('player').setup({
	file: 'https://www.youtube.com/watch?v=w2G5oim2mYM'
});
</script>
";  

?>

This question has received the maximum number of answers.