Flash Player不显示在Firefox上,但不显示在Chromium上 [英] Flash Player Does not Show up on Firefox but not Chromium

查看:320
本文介绍了Flash Player不显示在Firefox上,但不显示在Chromium上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做音频播放器扩展,我选择包装Wordpress音频找到这里
到目前为止,我已经在所有基于Webkit的浏览器上工作,但不是在Firefox上。我试图把自动启动,我可以听到在Firefox中的音频告诉我,Flash和JS代码加载好,但不显示(见附图)。

我已经尝试了所有的选择,并没有工作。这是我的第一个扩展,所以原谅任何明显的,并指出我请。

这是图像



< >





以下是完整的课程代码

 <?php 
/ **
*播放音乐文件的扩展名
*版权所有2013 Hosanna Higher Technologies
*作者:Stefano Mtangoo
* Wraps Wordpress媒体播放器
*
* /
类AudioPlayer延伸CWidget
{
/ **
*音频播放器JS文件
*仅供内部使用
* /
保护$ playerjs;
$ b / **
*音频播放器Flash文件
*仅供内部使用
* /
保护$ playerswf; //保存播放器flashplayer
$ b $ **
*玩家宽度
* @var整数
* /
public $ width = 290; //持有玩家宽度
/ / ===================== Reserver for future ===
/ **
*玩家标题
* @var字符串
* /
public $ title =; //持有玩家宽度

/ **
*玩家解析
* @var字符串
* /
public $ summary =; //持有玩家的宽度

/ **
*玩家选项
*要了解更多关于如何使用非WordPress的项目播放器,
*请访问{@link http://wpaudioplayer.com/standalone}
* @var数组
* /
public $ options = array ();
$ b / **
*播放器HTML附加属性
* @var数组
* /
public $ htmlOptions = array();
$ b / **
*播放器文件已通过
* @var数组
* /
public $ tracks = array();
$ b $ * b $ b public function renderContentBegin()
{
echo CHtml :: openTag('div',$ this-> htmlContentOptions);
if(!empty($ this-> content))
echo $ this-> content;
}
* /
// =================================
$ b $ * b $ b *当我们使用$ this-> beginWidget在视图中插入一个小部件时调用
* /
public function init()
{
如果($这 - > playerjs ===空)
{
$文件目录名=(__ FILE __)DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'audio-player.js ;
$ this-> playerjs = Yii :: app() - > getAssetManager() - > publish($ file);
}
如果($这 - > playerswf ===空)
{
$文件目录名=(__ FILE __)DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'player。 SWF';
$ this-> playerswf = Yii :: app() - > getAssetManager() - > publish($ file);
}

$ this-> registerClientScript();

parent :: init();

$ b $ * b $ b *在我们调用$ this-> endWidget
* /
时调用public function run()
{
//放置全部曲目
$ id = microtime();
$ id = str_replace(,,$ id);
$ id = str_replace(。,,$ id);

$ this-> htmlOptions ['id'] ='audioplayer _'。$ id; //替换ID

echo CHtml :: openTag('div',$这 - > htmlOptions);
echo'< p>您的浏览器不支持Flash!< / p>';
回显CHtml :: closeTag('div')。 \\\
;

$ files = implode(',',$ this-> tracks);
$ b $ tracktoAdd =AudioPlayer.embed(\audioplayer _ {$ id} \,{soundFile:\{$ files} \});;
echo CHtml :: script($ tracktoAdd);
// Yii :: app() - > clientScript-> registerScript(audioplayer_js _ {$ id},$ tracktoAdd / *,CClientScript :: POS_BEGIN * /);


$ b保护函数registerClientScript()
{
$ options =;
foreach($ this-> options as $ field => $ value)
{
if(!empty($ options))
{
$ options = $选项。 $场: $值。
}
else
{
$ options = $ options。$ field。':'。$ value;


$ b $ //在这里发布CSS或JavaScript文件...
$ cs = Yii :: app() - > clientScript;
// $ cs-> registerCssFile($ cssFile);
$ cs-> registerScriptFile($ this-> playerjs);
$ b $ JscodeForPlayer =

AudioPlayer.setup(\$ this-> playerswf\,{
{$ options},
});;
$ b $ if(!$ cs-> isScriptRegistered('audioplayer'))
$ cs-> registerScript('audioplayer',$ JscodeForPlayer,CClientScript :: POS_HEAD); // Player JS


code
$ b这些是浏览器中的输出


$ p $ < object id =audioplayer_0590975001386453307width =200height = 24type =application / x-shockwave-flashname =audioplayer_0590975001386453307style =outline:nonedata =/ assets / b5645ee9 / player.swf>
< param name =bgcolorvalue =#FFFFFF>
< param name =wmodevalue =transparent>
< param name =menuvalue =false>
将PARAM NAME = Flash变量 值=自动启动=没有与动画=否安培;音效档= /上传/ MP3 / 2013_12_07_18_15_16.mp3,/上传/ MP3 / 2013_12_07_18_15_16.mp3,/上传/ MP3 / 2013_12_07_18_15_16。 mp3和安培; playerID = audioplayer_0590975001386453307\" >
< / object>
< script type =text / javascript>
/ * LT; [CDATA [* /
AudioPlayer.embed( audioplayer_0590975001386453307,{音效档:/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads /mp3/2013_12_07_18_15_16.mp3\" });
/ *]]> * /
< / script>

Chromium

 < object type =application / x-shockwave-flashname =audioplayer_0250541001386451633style =outline:nonedata =/ assets / b5645ee9 / player.swfwidth =200height =24id =audioplayer_0250541001386451633> 
< param name =bgcolorvalue =#FFFFFF>
< param name =wmodevalue =transparent>
< param name =menuvalue =false>
将PARAM NAME = Flash变量 值= 自动启动=否放大器;放大器;动画=否放大器;放大器;音效档= /上传/ MP3 / 2013_12_07_18_15_16.mp3&放大器;放大器; playerID = audioplayer_0250541001386451633 >
< / object>

< script type =text / javascript>
/ *<![CDATA [* /
AudioPlayer.embed(audioplayer_0250541001386451633,{soundFile:/uploads/mp3/2013_12_07_18_15_16.mp3});
/ *]]> * /
< / script>


解决方案

Firefox不允许从本地加载Flash。
我不知道为什么它的政策,但这不是一个错误,而是一个 * 功能 *

Am trying to make audio Player extension and I choose to wrap Wordpress Audio found here So Far I have it working on all Webkit based browsers but not on firefox. I have tried to put auto start on and I can hear audio in firefox which tells me that flash and JS code loads fine but does not show up (see attached images).

I have tried all options in my head and did not work. This is my very first extension so forgive anything that is obvious and point out to me please.

Here are images

Here is the full class code

<?php
/**
  * Extension to Play Music Files
  * Copyright 2013 Hosanna Higher Technologies
  * Written by Stefano Mtangoo
  * Wraps Wordpress Media Player
  *
*/
class AudioPlayer extends CWidget
{
    /**
     * Audio Player JS File
     * For internal uses only
     */
    protected $playerjs; 

    /**
     * Audio Player Flash File
     * For internal uses only
     */
    protected $playerswf;// holds player flashplayer

    /**
     * Player Width 
     * @var integer
     */
    public $width = 290;// holds player width
    //=====================Reserver for future===
    /**
     * Player title 
     * @var string
     */
    public $title = "";// holds player width

    /**
     * Player descritption 
     * @var string
     */
    public $summary = "";// holds player width

    /**
     * Player Options
     * To see more information about using aforementioned player for non-Wordpress project, 
     * please visit {@link http://wpaudioplayer.com/standalone}
     * @var array
     */
    public $options = array();

    /**
     * Player HTML additional attributes
     * @var array
     */
    public $htmlOptions = array();

    /**
     * Player files Passed
     * @var array
     */
    public $tracks = array();

    /*
    public function renderContentBegin()
    {
        echo CHtml::openTag('div', $this->htmlContentOptions);
        if (!empty($this->content))
            echo $this->content;
    }
    */
    //=================================

    /*
     * called when we use $this->beginWidget to insert a widget in a view
    */
    public function init()
    {
        if($this->playerjs===null)
        {
            $file=dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'audio-player.js';
            $this->playerjs=Yii::app()->getAssetManager()->publish($file);
        }
        if($this->playerswf===null)
        {
            $file=dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'player.swf';
            $this->playerswf=Yii::app()->getAssetManager()->publish($file);
        }

        $this->registerClientScript();

        parent::init();
    }

    /*
     * is called when we call $this->endWidget
    */
    public function run()
    {
        //put all tracks
        $id = microtime();
        $id = str_replace(" ", "", $id);
        $id = str_replace(".", "", $id);

        $this->htmlOptions['id'] = 'audioplayer_'.$id;//replace ID

        echo CHtml::openTag('div', $this->htmlOptions);
        echo '<p> Your Browser does not support flash!</p>';
        echo CHtml::closeTag('div') . "\n";

        $files = implode(',', $this->tracks);

        $tracktoAdd = "AudioPlayer.embed(\"audioplayer_{$id}\", {soundFile: \"{$files}\"}); "; 
        echo CHtml::script($tracktoAdd);
        //Yii::app()->clientScript->registerScript("audioplayer_js_{$id}",$tracktoAdd/*, CClientScript::POS_BEGIN  */);

    }

    protected function registerClientScript()
    {
        $options = ""; 
        foreach ($this->options as $field => $value)
        {
           if(!empty($options))
           {
            $options = $options. ",".$field.':'.$value;
           }
           else
           {
            $options = $options.$field.':'.$value;
           }
        }

         // publish CSS or JavaScript file here...
        $cs=Yii::app()->clientScript;
        //$cs->registerCssFile($cssFile); 
        $cs->registerScriptFile($this->playerjs);

        $JscodeForPlayer = 
                        " 
                        AudioPlayer.setup(\"$this->playerswf\", {  
                            {$options}, 
                        });";

        if(!$cs->isScriptRegistered('audioplayer'))
            $cs->registerScript('audioplayer', $JscodeForPlayer, CClientScript::POS_HEAD  ); //Player JS
    }
}

Here are the output in browsers FF

<object id="audioplayer_0590975001386453307" width="200" height="24" type="application/x-shockwave-flash" name="audioplayer_0590975001386453307" style="outline: none" data="/assets/b5645ee9/player.swf">
<param name="bgcolor" value="#FFFFFF">
<param name="wmode" value="transparent">
<param name="menu" value="false">
<param name="flashvars" value="autostart=no&animation=no&soundFile=/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads/mp3/2013_12_07_18_15_16.mp3&playerID=audioplayer_0590975001386453307">
</object>
<script type="text/javascript">
/*<![CDATA[*/
AudioPlayer.embed("audioplayer_0590975001386453307", {soundFile: "/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads/mp3/2013_12_07_18_15_16.mp3,/uploads/mp3/2013_12_07_18_15_16.mp3"});
/*]]>*/
</script>

Chromium

<object type="application/x-shockwave-flash" name="audioplayer_0250541001386451633" style="outline: none" data="/assets/b5645ee9/player.swf" width="200" height="24" id="audioplayer_0250541001386451633">
<param name="bgcolor" value="#FFFFFF">
<param name="wmode" value="transparent">
<param name="menu" value="false">
<param name="flashvars" value="autostart=no&amp;animation=no&amp;soundFile=/uploads/mp3/2013_12_07_18_15_16.mp3&amp;playerID=audioplayer_0250541001386451633">
</object>

<script type="text/javascript">
/*<![CDATA[*/
AudioPlayer.embed("audioplayer_0250541001386451633", {soundFile: "/uploads/mp3/2013_12_07_18_15_16.mp3"}); 
/*]]>*/
</script>

解决方案

Firefox does not allow loading flash from the Localhost. I don't know why its their policy but that is not a bug but a *feature*

这篇关于Flash Player不显示在Firefox上,但不显示在Chromium上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆