first working version of streaming for windows iframe based
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 14 Dec 2011 18:28:58 +0000 (19:28 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Wed, 14 Dec 2011 18:28:58 +0000 (19:28 +0100)
web/winstream.php [new file with mode: 0644]
web/winstream_rd.php [new file with mode: 0644]

diff --git a/web/winstream.php b/web/winstream.php
new file mode 100644 (file)
index 0000000..f083907
--- /dev/null
@@ -0,0 +1,26 @@
+<html>
+<head>
+<script type="text/javascript" src="xynt/xynt-commons.js"></script>
+<script type="text/javascript" src="xynt/xynt-console.js"></script>
+<script type="text/javascript"><!--
+     var allmythings="BEGIN";
+     var ifra;
+
+function check_and_set() {
+    $('cont').innerHTML = allmythings;
+    // console.log(allmythings);
+}
+ window.onload = function () {
+     ifra = document.createElement("iframe");
+     ifra.style.visibility = "hidden";
+     document.body.appendChild(ifra);
+     ifra.contentWindow.location.href = 'winstream_rd.php';
+     setInterval(check_and_set, 500);
+ }
+
+     //-->
+</script>
+<body>
+<div id="cont">INIT</div>
+</body>
+</html>
diff --git a/web/winstream_rd.php b/web/winstream_rd.php
new file mode 100644 (file)
index 0000000..955269a
--- /dev/null
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script type="text/javascript" src="xynt/xynt-console.js"></script>
+</head>
+<body>
+</body>
+<?php
+function mop_flush()
+{
+    ob_flush();
+    flush();
+}
+
+function main()
+{
+    $s = "";
+    for ($i = 0 ; $i < 4096 ; $i++) {
+        $s .= rand(0,255);
+    }
+    for ($i = 0 ; $i < 20 ; $i++) {
+        
+        /*                    parent.document.getElementById('cont').innerHTML = \"%d\";
+                             parent.allmythings =  \"%d\"; */
+        printf("<script type=\"text/javascript\">
+                    parent.allmythings = %d;
+                    console.log(\"zorro \"+parent.allmythings);
+
+                </script>", $i);
+        if ($i == 0)
+            printf("%s", $s);
+        mop_flush();
+        sleep(1);
+    }
+}
+main();
+?>
\ No newline at end of file