【问题标题】:Javascript-Create Flash playerJavascript-创建Flash播放器
【发布时间】:2011-07-24 17:36:45
【问题描述】:

我有以下服务器端视频剪辑变量:$fileName = "bin-debug/Video Source/Black Eyed Peas - The Time.flv"; 我正在使用以下 Javascript 来创建带有此视频剪辑的播放器(我正在使用 Flex 视频组件)

function createPlayer(videoSource){
    document.writeln("<div id=\"player\">");
    document.writeln("<object width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
    document.writeln("<param name=\"player\" value=\"bin-debug/FlexPlayer.swf\">");
    document.writeln("<embed src=\"bin-debug/FlexPlayer.swf\" name=\"player\" width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
    document.writeln("</embed>");
    document.writeln("</object>");
    document.writeln("</div>");               
}

函数调用是这样的

<script type="text/javascript">
var videoSource = "<?php echo $fileName; ?>";
    createPlayer(videoSource);
</script>

由于某种原因,播放器没有播放不同的视频。也许问题出在指定 videoSourcew 标记的 MXML 中?任何帮助将不胜感激。

【问题讨论】:

    标签: php flash flashvars


    【解决方案1】:

    可能是这样

    document.writeln("<param name=FlashVars value="+videoSource+">");
    

    ?

    编辑

    然后您已经定义了 FlashVars 参数,但它没有在嵌入中调用

    在嵌入后添加这个 height=\"414\"

    FlashVars=\""+videoSource+"\"
    

    对于这个结果

    document.writeln("<embed src=\"bin-debug/FlexPlayer.swf\" name=\"player\" width=\"489\" height=\"414\" FlashVars=\""+videoSource+"\">");
    

    【讨论】:

    • 仍然没有播放不同的视频
    • 运行 Google Chrome Inspect Element 后,我​​看到 param 标签看起来像这样:
    • 我在检查元素之后编辑了上面的代码,它看起来正确,但播放器中的视频没有改变
    猜你喜欢
    • 2011-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多