引用enyo.kind()中的参数

时间:2014-03-26 14:56:30

标签: javascript enyo

我有两种,一种是视频类,另一种是包含视频类的自定义类。我想将参数videoStream传递给种类VideoPlayerPage并让subkind Video将此参数设置为src。我该怎么做?

var el  =  new VideoplayerPage({stream: videoStream });
el.renderInto(document.getElementById("formContainer")); 

enyo.kind({
        name: "Videoplayer",
        kind : "Video",
        style: "margin-top: 100px;",
        poster : null,
        src : null
    });


enyo.kind({
    name: "VideoplayerPage",
    kind: "FittableRows",
    style: "margin-top: 100px;",
    published: {
        stream : null
    },
    create : function(){
        this.inherited(arguments); 
        this.streamChanged();
        console.log("Creating video page"+ this.stream);
    },
    classes: "data-grid-list-sample data-repeater-sample enyo-fit", 
    components : [
        {kind : "Videoplayer", src: this.stream, showControls : true, fitToWindow : true, autoplay :true},
        {tag: "br"},
        {kind : "moon.Button"},
        {kind : "moon.Button"}
    ],
    streamChanged: function() {
        //this.$.stream.setContent(this.stream);
        this.setStream(this.stream);
    }
});

1 个答案:

答案 0 :(得分:0)

没关系我弄清楚了。我给了我的视频类一个名字“播放器”,然后在创建功能中设置它。

create : function(arg){
        this.inherited(arguments); 
        this.$.player.setSrc(this.stream);
}