- Home /
Webplayer run in php
Hi,
I wanna run unity webplayer in php, not html.
so, I try like this.
test.php
<?php
$dec = "<script type=\"text/javascript\"
src=\"http://webplayer.unity3d.com/
download_webplayer-3.x/3.0/uo/UnityObject.js\"></script>";
$code = "function GetUnity() {
if (typeof unityObject != \"undefined\") {
return unityObject.getObjectById(\"unityPlayer\");
}
return null;
}
if (typeof unityObject != \"undefined\") {
var params = {
backgroundcolor: \"FFFFFF\",
bordercolor: \"000000\",
textcolor: \"000000\",
logoimage: \"logo.png\",
progressbarimage: \"ProgressBar.png\",
progressframeimage: \"ProgressFrame.png\",
disableContextMenu: true
};
unityObject.embedUnity(\"unityPlayer\", \"WebPlayer.unity3d\",
892, 790, params);
}";
$str = $dec."<script type=\"text/javascript\">".$code."</script>";
echo $str;
?>
I call test.php in IE.
but there are no action in browser and it has no error.
any idea?
or
how to run unity player in php?
thanks!:)
Any errors on the IE console?
I hope you plan to do something else with that, because currently the only thing you do there is running a PHP that generates a HT$$anonymous$$L that contains just a JS. Try browsing your page on Chrome and open the developer tools with Ctrl+Shift+I. It has a more pleasant console than I$$anonymous$$
It is not a good practice to put HT$$anonymous$$L code inside a string that is printed by PHP (at least not when the HT$$anonymous$$L code is long). You would have a much nicer PHP page if you do it the other way around - write HT$$anonymous$$L code, and have PHP commands embedded in it.
Using this method, I would simply suggest you take the HT$$anonymous$$L page generated by Unity, rename it to .php, and replace anything you want to come from PHP code with PHP commands.
In any case, no matter how you choose to do it, you can simply compare the output of your PHP with the plain HT$$anonymous$$L and see where your problems are.
Your answer
Follow this Question
Related Questions
Install unity web player from flash 2 Answers
Web Player Javascript Documentation 2 Answers
How o I prevent streamed video stutter? 1 Answer
Full Screen Web Player? 7 Answers
How much data can I send from the browser through unityObject.SendMessage()? 1 Answer