This is an extention to stackflow qustion. I want to create div programmatically and attach the opentok subscriber cam to it and all the subscriber cam need to come under parent div "#subscription". Please let me know what I'm doing wrong in my code.
Jsfiddle
http://jsfiddle.net/6z9n65ty/55/
Updated Jsfiddle
http://jsfiddle.net/6z9n65ty/59/
Code for subscription div
enyo.kind({
name : "blanc.SubscriberWrapper",
showing: true,
stream: null,
session: null,
create: function(){
this.inherited(arguments);
if(this.stream != null && this.session != null){
this.subscribe();
}
},
subscribe: function(){
this.session.subscribe(this.stream, this.hasNode());
}
});
Update
I want to attach the stream to subscribeButton, the below code will add the first subscriber stream to "#subscribeButton". If second subscribe stream exist, then it will overwrite previous subscribe cam video with second stream. I want to have all the subscribers to be viewed in the screen. So I was trying to create new div using create function.
streamCreated: function (event) {
this.session.subscribe(event.stream, subscribeButton);
// Add subscriber stream to a new div
// this.createComponent({kind: "blanc.SubscriberWrapper", name : event.stream.id, stream: event.stream, session: this.session});
// this.render();
},
JSFIDDLE