Search code examples
flashdojowowza

DojoX Flash streaming


When I use jwplayer with following config everything is OK.

jwplayer('someId').setup({
        'flashplayer': '/js/jwplayer/player.swf',
        'file':        'awesome.flv',
        'streamer':    'rtmp://some.server.com:1934/vod',
        'width':       '220',
        'height':      '190'
    });

When I use dojo with following config:

new Flash({
    path:   'rtmp://some.server.com:1934/vod?file=awesome.flv' ,
    width:    220,
    height:   190
    }, this.someId);

Flash place holder is visible, but no controls to play stream and in the console I can see error that have no meaning for me...

Building SWF failed.
[Break On This Error]   

comboPendingTimer = null;

dojo.js (line 648)

What is wrong with dojo flash config? Another thing is how to tell dojo to use object tag? Right now it uses some strange embed tag...

Dojo version 1.7.2 documentation not that helpful http://dojotoolkit.org/reference-guide/1.7/dojox/flash.html


Solution

  • Dojox.embed.Flash is merely a browser sniffing utility which will present the <embed> or <object> in a way that suits the users browser the best.

    Youre doing the wrong path, the Flash object would not know how to handle a streaming flv file, it needs to point to a swf.

    Options to work with

    var dataurl =    "player.swf"
    var flashvars =  {'file':'playlist.xml','autostart':'true'};
    var params =     {'allowfullscreen':'true','allowscriptaccess':'always', 'bgcolor':'#ffffff'};
    var attributes = {'id': 'player1','name':'player1'};
    var expressInstall = "http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75"
    

    using swfobject with jwplayer

    This is a sample from longtail showing howto embed via swfobject:

    swfobject.embedSWF(dataurl, 'flashContent', '300', '250', '9', 'false', flashvars, params, attributes);
    

    thus from the prototype embedSWF which is:

    swfobject.embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, 
         swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj,
         attObj, callbackFn)
    

    using dojox.embed.Flash with jwplayer

    See reference guide for parameters

    Mapping above results to

    new Flash({
        width: 300,
        height: 250,
        minimumVersion: 9,
        expressInstall : expressInstall,
        allowScriptAccess: true,
    
        path: dataurl,
        id: 'player1',
        vars: flashvars,
        params: params        
    
    }, 'flashContent');