【问题标题】:Firefox-only bug when calling .flv videos from xml file using php使用 php 从 xml 文件调用 .flv 视频时仅 Firefox 的错误
【发布时间】:2010-01-29 19:01:44
【问题描述】:

我有一个简单的网站来播放一些 Flash 视频。我将视频及其相关 cmets 的信息存储在 xml 文件中。我使用 SimpleXML 来遍历所有这些内容并按时间倒序显示这些内容。一切都在 IE8、Safari 和 Chrome 中完美运行,但在 Firefox 中,屏幕上的所有视频都显示相同的视频(simpleXML 数组中 [0] 处的那个)。所有相关信息(标题、cmets 等)都是正确的,查看 html 输出显示 FLV 播放器正在调用正确的文件……但 Firefox 不会显示它!

那么:我可以在 php 脚本中解释 Firefox DOM 中的一些怪癖吗?我能做些什么? 页面在这里:http://omega.uta.edu/~ktb7964/

还有一些源代码: PHP 循环:

<?php
//this script uses a few for loops to first count the number of video/comment entries in the related xml file, 
//and then count backwards through them so they are all displayed in reverse chronological order.
//$v is the array position for a video element and $c is the array position for a comment element.
for($v=0; $xml->video[$v];$v++) {}
$v--;
for($v; $v >= 0;$v--) {
    //the code that declares the FLV player needs to be split into pieces so we can concatenate them with $v.
    $script1 = file_get_contents('script1.htm');
    $script2 = file_get_contents('script2.htm');
    $script3 = file_get_contents('script3.htm');
    $script4 = file_get_contents('script4.htm');
    echo("<h2>" . $xml->video[$v]->title . "</h2>");
    echo($script1 . $v . $script2 . $xml->video[$v]->file . $script3 . $xml->video[$v]->url . $script4);
    echo("<h3>Comments:</h3>");
    echo("<form action=\"post".$v.".php\" method=\"post\" name=\"postcomment".$v."\">");
    echo("<input name=\"position\" type=\"hidden\" value=\"".$v."\" />");
    echo("<input name=\"username\" type=\"text\" size=\"30\" maxlength=\"20\" value =\"Username:\" onblur=\"if(this.value=='') this.value='Username:';\" onfocus= \"this.value='';\" /></p>");
    echo("<p><textarea name=\"text\" cols=\"50\" rows=\"5\"></textarea></p>");
    echo("<input name=\"submit\" type=\"submit\" value=\"Post a Comment\" />");
    echo("</form>");
    for($c=0; $xml->video[$v]->comments->comment[$c];$c++) {}
    $c--;
    if($c < 0){
        echo("<p><i>No comments yet.</i></p>");}
        else {
    for($c; $c >= 0; $c--) {
        echo("<h4>" . $xml->video[$v]->comments->comment[$c]->poster . " said: </h4>");
        echo("<p>" . $xml->video[$v]->comments->comment[$c]->post . "</p>");
        echo("<hr />"); }

    }
    }
?>

还有一段xml文件:

<videos>
    <video>
        <uid>0</uid>
        <title>The Real World: UTA</title>
        <file>draft</file>
        <comments>
            <comment>
                <poster>Fooman</poster>
                <email>fooman@domain.com</email>
                <post>"This video is so exciting!</post>
            </comment>
            <comment>
                <poster>Foogirl</poster>
                <email>foogirl@domain.com</email>
                <post>"Ha! That was hilarious!"</post>
            </comment>
        </comments>
    </video>
</videos>

谢谢!

【问题讨论】:

    标签: php xml firefox simplexml


    【解决方案1】:

    首先,您的object 标签至少在您的一些id 属性中有空格,例如:id="FLVPlayer 0"。如果您需要使用下划线或连字符的分隔符,id 必须是连续字符串。

    我会首先尝试尽可能多地验证它。由于 Flash 和跨浏览器支持,这里的一些警告将是不可避免的,所以你必须解决这些问题,但非 Flash 的东西应该有效。

    http://validator.w3.org/check?uri=http%3A%2F%2Fomega.uta.edu%2F~ktb7964&charset=%28detect+automatically%29&doctype=Inline&group=0

    【讨论】:

    • 我清理了你在 Wamp Server 上提到的一些东西,但问题仍然存在。 @prodigitalson:感谢您添加代码块:直到我提交后才找到它的按钮!
    猜你喜欢
    • 2011-03-09
    • 2011-03-17
    • 2012-04-08
    • 2012-01-29
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2020-11-05
    • 2011-03-10
    相关资源
    最近更新 更多