app:mp3player
| Widget Name | appcelerator mp3player |
| Element | <app:mp3player> |
| Author | Hamed Hashemi |
| Homepage | http://www.appcelerator.org |
| Description | mp3player widget is a flash based mp3 player based from http://www.1pixelout.net/code/audio-player-wordpress-plugin |
- Required Attributes (0)
- Optional Attributes (2)
- Examples (1)
- Source code
| Name | Type | Description | Default value |
|---|---|---|---|
| There are no required attributes | |||
| Name | Type | Description | Default value |
|---|---|---|---|
| on | On Expression | Load up the mp3 player with a specified URL | Not specified |
| property | Identifier | Property used in the on expression that defines the mp3 URL | url |
Back to menuExample: Simple Example
\n
$MQ('l:play', {url: 'http://media.libsyn.com/media/redmonk/riaweekly008.mp3'});
This is a simple example that uses the <app:mp3player>.
<app:mp3player on="l:play then execute" property="url"></app:mp3player> <app:script> $MQ('l:play', {url: 'http://media.libsyn.com/media/redmonk/riaweekly008.mp3'}); </app:script>
1 /* 2 * This file is part of Appcelerator. 3 * 4 * Copyright (C) 2006-2008 by Appcelerator, Inc. All Rights Reserved. 5 * For more information, please visit http://www.appcelerator.org 6 * 7 * Appcelerator is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 22 23 Appcelerator.Widget.Mp3player = 24 { 25 getName: function() 26 { 27 return 'appcelerator mp3player'; 28 }, 29 getDescription: function() 30 { 31 return 'mp3player widget is a flash based mp3 player based from http://www.1pixelout.net/code/audio-player-wordpress-plugin'; 32 }, 33 getVersion: function() 34 { 35 return '1.0'; 36 }, 37 getSpecVersion: function() 38 { 39 return 1.0; 40 }, 41 getAuthor: function() 42 { 43 return 'Hamed Hashemi'; 44 }, 45 getModuleURL: function () 46 { 47 return 'http://www.appcelerator.org'; 48 }, 49 isWidget: function () 50 { 51 return true; 52 }, 53 getWidgetName: function() 54 { 55 return 'app:mp3player'; 56 }, 57 getActions: function() 58 { 59 return ['execute']; 60 }, 61 getAttributes: function() 62 { 63 return [{ 64 name: 'on', 65 optional: true, 66 type: Appcelerator.Types.onExpr, 67 description: "Load up the mp3 player with a specified URL" 68 }, { 69 name: 'property', 70 optional: true, 71 defaultValue: 'url', 72 type: Appcelerator.Types.identifier, 73 description: "Property used in the on expression that defines the mp3 URL" 74 }]; 75 }, 76 audioplayerId: 0, 77 execute: function(id,parameterMap,data,scope,version,customdata,direction,type) 78 { 79 var propertyName = parameterMap['property']; 80 var mp3 = data[propertyName]; 81 82 if (mp3) 83 { 84 var element = $(parameterMap['id']); 85 var playerDiv = $(parameterMap['id'] + '_player'); 86 if (playerDiv) 87 { 88 Element.remove(playerDiv); 89 } 90 var audioplayerId = ++Appcelerator.Widget.Mp3player.audioplayerId; 91 92 var swf = Appcelerator.WidgetPath + 'app_mp3player/swf/player.swf'; 93 var html = '<div id="' + parameterMap['id'] + '_player">'; 94 html += '<object type="application/x-shockwave-flash" data="' + swf + '" id="audioplayer' + audioplayerId + '" height="24" width="290">'; 95 html += '<param name="movie" value="' + swf + '">'; 96 html += '<param name="FlashVars" value="playerID='+audioplayerId+'&soundFile='+mp3+'">'; 97 html += '<param name="quality" value="high">'; 98 html += '<param name="menu" value="false">'; 99 html += '<param name="wmode" value="transparent">'; 100 html += '</object>'; 101 html += '</div>'; 102 103 element.innerHTML = html; 104 } 105 }, 106 buildWidget: function(element,parameters) 107 { 108 var html = '<div id="' + parameters['id'] + '"></div>'; 109 110 return { 111 'position' : Appcelerator.Compiler.POSITION_REPLACE, 112 'presentation' : html, 113 }; 114 } 115 }; 116 117 Appcelerator.Widget.registerWithJS('app:mp3player', Appcelerator.Widget.Mp3player,['audio-player.js']); 118
Chapters
- Web Expressions (Interaction)
- Web Expressions (Visual)
- Web Expression Macros
-
Widget Reference
- app:as_flexflow
- app:box
- app:button
- app:calendar
- app:chart
- app:content
- app:datacache
- app:datatable
- app:download
- app:editinplace
- app:ext_grid
- app:ext_paging_grid
- app:ext_tree
- app:field
- app:folder
- app:graphical_music_player
- app:http
- app:if
- app:imagetransition
- app:iterator
- app:message
- app:modalbox
- app:modaldialog
- » app:mp3player
- app:music_player
- app:pagination
- app:panel
- app:progressbar
- app:script
- app:search
- app:security
- app:shadowbox
- app:simple_panel
- app:statemachine
- app:stopwatch
- app:tabpanel
- app:template
- app:tooltip
- app:upload
- app:validation
- app:widget
- app:yui_map
- CSS Helper Classes
- Advanced Configuration
- Debugging
- Forms
- Localization
- Interpolation
- Javascript Variables
- Javascript Functions
- Service Broker