Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    4
    Vote Rating
    0
      0  

    Default Worked! Thank you!

    Thank you sincerely that worked!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •