msnbc.modules.TestVideoPlayer = msnbc.modules.Module.extend({ setup: function(data, container) { this.SHORT_NAME = "vi"; this.data = data; var launch = ''; if (data.content && data.content[0]) { launch = data.content[0].id; }; var options = { settings: msnbc.document.settings.VIDEO_SETTINGS, docId: "25628404", src: msnbc.document.settings.VIDEO_PLAYER, playerid: "25628404", launch: launch, id: this.vpId }; var self = this; this.vidPlayer = this.addComponent("msnbc.components.video.TestVideoPlayer", options); this.vidPlayer.addListener("onTitleChange", function(params) { self.onTitleChange(params); }); this.title = container.title; this.markup = container.markup; this.container = container; // setup share links this.shareMenu = this.addComponent("msnbc.components.ShareMenu"); this.shareMenu.setup($(this.title).text(), new msnbc.misc.URLCommand(this.SHORT_NAME), null, [{id:launch}]); this.shareMenu.insert($(this.title).parent()); }, render: function() { if (this.rendered) return; this.vidPlayer.insertOn(this.markup.find('.flash-slot')); this.rendered = true; $(this.__container.slot).find('.preloader').remove(); var id = this.data.content[0].id || ''; var urlCommand = new msnbc.misc.URLCommand(this.SHORT_NAME, null, [{id:id}]); this.shareMenu.updateShareCommand(urlCommand); //this.dispatchEvent("contextChange", urlCommand); }, playByID: function(params) { //this.vidPlayer.play(id); }, handleURLParams: function(params) { if (params.id) { this.vidPlayer.embedParams.flashvars.launch = params.id; }; }, getInterface: function() { return { names: [this.SHORT_NAME, "video"], commands: { generic: function(params) { this.handleURLParams(params); }, hi: function() { this.container.close(); }, pl: function(params) { this.playByID(params); } } }; }, getNavTease: function(nav) { return { "label": "Video", "icon": "video", "abstract": this.data.content[0].image || '', "title": $(this.title).find('span.subhead').text(), "href": "#video-player", "source": this.data.content[0].source || '' }; }, onTitleChange: function(params) { $(this.title).find('.subhead').text(params.title); var urlCommand = new msnbc.misc.URLCommand(this.SHORT_NAME, null, [{id:params.id}]); this.shareMenu.updateShareCommand(urlCommand); this.dispatchEvent("contextChange", urlCommand); }, toString: function() { return '[Module TestVideoPlayer]'; } });