1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    groophug is on a distinguished road

      0  

    Default Answered: desperately need help passing data to 'VIDEO' correctly

    Answered: desperately need help passing data to 'VIDEO' correctly


    Please excuse me if this seems like a redundant question, however, i have searched the Sencha Touch QA to no avail. I am a nubee here, so I'm looking for best practice and correct way to do the following. Any specific examples would be ever so greatly appreciated, as i would like to use best practices.

    I am passing data from a list view to a detail panel using the following method:

    Code:
    ...
    itemtap: function (list, index, target, record) {
    ...
      Ext.Viewport.animateActiveItem (
        {xtype: 'page_videoplayer', data: record.data},
        {type:'pop'}
      );
    }
    I am able to access that data partially, however i would like to access that data inside of the 'video' xtype in my detail panel in order to set the 'url' and 'posterUrl' correctly ... see the following code ... again any help here greatly appreciated.

    This is my detail panel: 'page_videoplayer'

    Code:
    Ext.define('myapp.view.panel_VideoPlayer', {
    	extend: 'Ext.Panel',
    	xtype: 'page_videoplayer',
    	
    	requires: [
    		'Ext.Video'
    	],
    	
    	initialize:function (){
    				var panels = this.query('panel[tpl]'),
    				pLen = panels.length,
    				p = 0,
    				panel;
    				for (p=0; p < pLen; p++) {
    					panel = panels[p];
    					panel.setData(this.getData());
    			    }
    	},
    	
    	layout: {
    		type: 'vbox'
    	},
    	
    	config: {
    		title: 'VideoPlayer',
    		cls: 'bluePanel',
    		scrollable: true,
    		styleHtmlContent: true,
    		
    		items: [
    			{
    				items:[
    					{
    		                xtype: 'video',
    						itemId: 'vplayer',
    						title: 'video player',
    						width: '100%',
    						height: 200,
    						listeners: {
    							activate: function(){
    								// HOW WOULD I CORRECTLY ACCESS THE DATA HERE? WHAT I AM TRYING IS NOT WORKING 
    								this.setUrl('http://s3.amazonaws.com/cf-templates-1vy0cxj1zsmok-us-east-1/videos_encoded/'+record.getData('videofile')+'.m4v');
    								this.setPosterUrl('http://s3.amazonaws.com/cf-templates-1vy0cxj1zsmok-us-east-1/videos_encoded/'+record.getData('videofile')+'_0000.png');
    							}
    						}
    		        	}
    				]
    			},
    			{
    		        xtype:'panel',
    				tpl:[
    				// VIA THE INITIALIZE FUNCTION ABOVE I AM ABLE TO ACCESS THE DATA CORRECTLY HERE
    				'Title: {videotitle}</br>',
    				'User: {username}</br>',
    				'Rating: {videorating}</br>',
    				'Views: {videoviews}',
    				'',
    				''
    				].join(''),
    				flex:1
    			},
    			{
    				xtype: 'button',
    				text: 'close',
    				ui: 'confirm',
    				action: 'btn_player_close',
    				cls: 'button_display',
    				height: 40,
    				width: 200
    			}
    		]
    	}
    });

  2. In the initialize method you can go down to the video component and set the url on it.

    Code:
    this.down('video').setUrl('...')l

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    In the initialize method you can go down to the video component and set the url on it.

    Code:
    this.down('video').setUrl('...')l
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
    groophug is on a distinguished road

      0  

    Default Worked! Thank you!

    Worked! Thank you!


    Thank you sincerely — that worked!

Thread Participants: 1

Tags for this Thread