├── .github └── ISSUE_TEMPLATE │ ├── 00-bug-report.md │ └── 10-feature-request.md ├── README.md └── samples ├── air_diagnostics ├── AIR Diagnostics.pdf ├── AIRDiagnosticsDemo.swf ├── Main.as ├── README.md ├── ane │ └── AIRDiagnostics.ane ├── application.xml └── icons │ ├── icon_114.png │ ├── icon_120.png │ ├── icon_144.png │ ├── icon_152.png │ ├── icon_48.png │ ├── icon_57.png │ ├── icon_72.png │ ├── icon_76.png │ └── icon_96.png ├── android_play_asset_delivery ├── TestPlayAssetDelivery.as ├── app.xml ├── assetpacks │ ├── fast_follow_asset_pack_files │ │ └── fast_follow_asset_pack_test_file.txt │ ├── install_time_asset_pack_files │ │ └── install_time_asset_pack_test_file.txt │ └── on_demand_asset_pack_files │ │ └── on_demand_asset_pack_test_file.txt └── build.xml └── mediabuffer_rendering ├── ane ├── build.xml ├── native │ └── MediaBufferRender.c └── swc │ ├── build.xml │ └── sources │ └── com │ └── harman │ └── extension │ └── MediaBufferRender.as ├── build.xml └── swf ├── app.xml ├── build.xml └── src ├── com └── harman │ └── air │ └── MediaBufferRender.as └── harman-logo.png /.github/ISSUE_TEMPLATE/00-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Issue 3 | about: Use this template for reporting a bug 4 | labels: 'Bug' 5 | --- 6 | 7 | Before reporting this issue: 8 | 9 | - you should consider whether this would be a question better suited to discussions above ^^ ; 10 | - make sure you have searched for similar issues and add your experience there if one exists. 11 | 12 | 13 | ## Problem Description 14 | 15 | Describe your problem in detail. Include the following information: 16 | 17 | * Which AIR SDK did you use? 18 | * Describe the affected environment: Android vs. iOS, all devices vs. just specific models. 19 | * Can you reproduce it yourself, or did you get reports from other users? If so, how many users are affected (percentage)? 20 | 21 | 22 | ## Steps to Reproduce 23 | 24 | Tell us how this issue can be reproduced. Seriously: if you want this issue to be fixed, this is the part you **really** need to get nailed. 25 | 26 | Give us a minimal example: 27 | 28 | * As little code as possible. Get to the root of the problem! 29 | * As few dependencies as possible. Did the problem pop up with Feathers? Try to reproduce it with Starling only. 30 | * Remove any ANEs (except if they are vital for the problem). 31 | * Include all necessary files (e.g. textures). 32 | 33 | 34 | ## Known Workarounds 35 | 36 | Just in case others run into this – do you happen to know of a workaround? Otherwise, just remove this section altogether. 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/10-feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Use this template for raising a feature request 4 | labels: 'Feature' 5 | --- 6 | 7 | Before reporting this issue: 8 | 9 | - you should consider whether this would be a question better suited to discussions above ^^ ; 10 | - make sure you have searched for similar feature requests and add your ideas there if one exists. 11 | 12 | 13 | ## Description 14 | 15 | Describe your feature request in detail. 16 | 17 | - Will this change the current API? How? 18 | - Who will benefit from this feature? 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | AIR SDK logo 6 |

7 | 8 |

AIR Issue Tracker and Discussion Forum

9 | 10 | 11 | This project acts as an **issue tracker** for bugs and feature requests connected to the *AIR SDK and Runtime*. 12 | It does not contain any source code. 13 | 14 | --- 15 | 16 | Now that Harman has taken over AIR development, we need a new place to discuss and report problems and make sure they know what's relevant to the community! 17 | That's what this repository is all about. 18 | 19 | There are two major parts to this repository: 20 | 21 | - [Discussions](https://github.com/airsdk/Adobe-Runtime-Support/discussions) : A discussion forum for questions, ideas and general chat; 22 | - [Issues](https://github.com/airsdk/Adobe-Runtime-Support/issues) : An issue tracker to report real bugs with the AIR SDK; 23 | 24 | Always go to the **discussion** section first and only report an **issue** if you are sure it is a bug and have a reproducable case. 25 | 26 | 27 | ## I found a bug in the runtime! What do do?! 28 | 29 | First of all, use the search feature to find out if somebody already reported a similar issue. 30 | Also have a look at the [discussions section](https://github.com/airsdk/Adobe-Runtime-Support/discussions)! 31 | 32 | ### a) This issue was already reported 33 | 34 | * Vote for that issue. To do that, click on the "Add your reaction" button at the top of the issue description and click on the :+1: symbol. 35 | * If possible, provide additional information by adding a comment. 36 | 37 | ### b) This is a new issue 38 | 39 | * Create a [new issue](https://github.com/airsdk/Adobe-Runtime-Support/issues/new/choose) in this repository. 40 | * A template will pop up that will help you collect all necessary information. 41 | * Only a problem that can be reproduced has a chance of being fixed! Thus, create a minimal sample and provide all the information needed to get it running. 42 | * I can't stress this enough: the easier you make it for Harman to recreate the problem, the higher your chances of a fix! 43 | 44 | 45 | ## I've got a question I can't answer 46 | 47 | * Do **not** open up a new issue. Instead, 48 | * head over to the [discussions section](https://github.com/airsdk/Adobe-Runtime-Support/discussions) and ask your question there. 49 | -------------------------------------------------------------------------------- /samples/air_diagnostics/AIR Diagnostics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/AIR Diagnostics.pdf -------------------------------------------------------------------------------- /samples/air_diagnostics/AIRDiagnosticsDemo.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/AIRDiagnosticsDemo.swf -------------------------------------------------------------------------------- /samples/air_diagnostics/Main.as: -------------------------------------------------------------------------------- 1 | package 2 | { 3 | import com.harman.air.AIRDiagnostics; 4 | import com.harman.air.DiagnosticEvent; 5 | import com.harman.air.DiagnosticInfo; 6 | import com.harman.air.DiagnosticReport; 7 | import flash.desktop.NativeApplication; 8 | import flash.events.Event; 9 | import flash.display.Sprite; 10 | import flash.display.StageAlign; 11 | import flash.display.StageScaleMode; 12 | import flash.events.TimerEvent; 13 | import flash.filesystem.File; 14 | import flash.system.Capabilities; 15 | import flash.system.MessageChannel; 16 | import flash.system.Worker; 17 | import flash.system.WorkerDomain; 18 | import flash.ui.Multitouch; 19 | import flash.ui.MultitouchInputMode; 20 | import flash.utils.Timer; 21 | import flash.utils.getTimer; 22 | 23 | /** 24 | * @author Andrew Frost 25 | * 26 | * Note: this uses both Workers and ANEs. The background Worker is using the same SWF as the primordial Worker, 27 | * and references the AIRDiagnostics ANE classes - which means that the worker will also need to load in the 28 | * ANE's library.swf file, for which it will need to be in the application security domain. 29 | * So to avoid the worker automatically terminated on start-up, you need to pass 'true' into the createWorker 30 | * method for 'giveAppPrivileges'. 31 | * 32 | * The primordial worker is the one that is dealing with the diagnostics (in this demo) and is configuring this 33 | * just for Worker information as well as errors and long function calls. If there are any ANEs or other crashes then 34 | * when the app starts up, it should find the log files left over (checkForOldDiagnostics method). In a normal 35 | * shutdown, those files should be cleaned up on exit. On Android this would mean the NativeApplication.exit() call, 36 | * rather than the user terminating the application via the operating system. 37 | * 38 | * To trigger the error, the background worker just sends a message every 5s, and the foreground worker will 39 | * close the message channel after 22 seconds. The error will be reported back to the app via the diagnostics 40 | * error mechanism. If the error is a 'channel closed' error, the Worker log will be read and traced out. 41 | * 42 | * The 'long_func' mechanism can result in a large log, so this is actually cleaned out periodically - when the 43 | * foreground worker receives a message from the background. Note that this requires 51.1.3.8 or later. 44 | * 45 | * Nothing appears on the screen for this test, the functionality needs to be checked via the trace log e.g. via 46 | * ADB (or "adt -deviceLog"), or via Adobe Scout or a Flash Debugger connection. 47 | */ 48 | public class Main extends Sprite 49 | { 50 | private var _background : Worker; 51 | private var _messageChannel : MessageChannel; 52 | private static const MESSAGE_CHANNEL_BACKGROUND_TO_PRIMORDIAL : String = "messagesToPrimordial"; 53 | private var _diagInfo : DiagnosticInfo; 54 | 55 | public function Main() 56 | { 57 | stage.scaleMode = StageScaleMode.NO_SCALE; 58 | stage.align = StageAlign.TOP_LEFT; 59 | stage.addEventListener(Event.DEACTIVATE, deactivate); 60 | 61 | // touch or gesture? 62 | Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT; 63 | 64 | // Entry point 65 | 66 | // Set up the worker 67 | if (Worker.current.isPrimordial) 68 | { 69 | // set up diagnostics 70 | _diagInfo = DiagnosticInfo.instance; 71 | _diagInfo.debugFunction = debugFunc; 72 | // check for old reports 73 | checkForOldDiagnostics(); 74 | // set up listeners for diagnostic info 75 | setupDiagnostics(); 76 | _diagInfo.start( AIRDiagnostics.DiagCheckLongFunc | AIRDiagnostics.DiagLogErrorCallstacks | AIRDiagnostics.DiagLogWorker ); 77 | 78 | // create the new worker and message channel 79 | _background = WorkerDomain.current.createWorker(this.loaderInfo.bytes, true); // must give app privileges to reference ANE classes 80 | _background.addEventListener(Event.WORKER_STATE, onBackgroundWorkerStateChange); 81 | _messageChannel = _background.createMessageChannel(Worker.current); 82 | _messageChannel.addEventListener(Event.CHANNEL_MESSAGE, onMessage); 83 | _background.setSharedProperty(MESSAGE_CHANNEL_BACKGROUND_TO_PRIMORDIAL, _messageChannel); 84 | _background.start(); 85 | 86 | trace("Started up"); 87 | 88 | // add a timer to close the message channel after 22s 89 | var tClose : Timer = new Timer(22000, 1); 90 | tClose.addEventListener(TimerEvent.TIMER, function(e:Event) : void { 91 | trace("Closing message channel"); 92 | _messageChannel.close(); 93 | }); 94 | tClose.start(); 95 | 96 | } 97 | else 98 | { 99 | _messageChannel = Worker.current.getSharedProperty(MESSAGE_CHANNEL_BACKGROUND_TO_PRIMORDIAL); 100 | // Background: just periodically send messages 101 | var tSend : Timer = new Timer(5000); 102 | tSend.addEventListener(TimerEvent.TIMER, function(e:Event) : void { 103 | trace("Sending message.."); 104 | _messageChannel.send("Time = " + getTimer()); 105 | }); 106 | tSend.start(); 107 | } 108 | } 109 | 110 | private function debugFunc(str : String) : void 111 | { 112 | trace("Debug message from ANE: " + str); 113 | } 114 | 115 | private function onBackgroundWorkerStateChange(e : Event) : void 116 | { 117 | var background : Worker = e.target as Worker; 118 | trace("Background worker state = " + background.state); 119 | } 120 | 121 | private function onMessage(e : Event) : void 122 | { 123 | trace("Message received : " + _messageChannel.receive() as String); 124 | _diagInfo.clearLog(AIRDiagnostics.DiagCheckLongFunc); 125 | } 126 | 127 | private function deactivate(e:Event):void 128 | { 129 | // make sure the app exits when in background on Android 130 | // (graceful shutdown is required to clean up the diagnostic log area) 131 | if (Capabilities.version.startsWith("AND")) 132 | NativeApplication.nativeApplication.exit(); 133 | } 134 | 135 | private function checkForOldDiagnostics() : void 136 | { 137 | // check if we have any old reports 138 | var reports : Vector. = _diagInfo.reports; 139 | if (reports.length) 140 | { 141 | // deal with them 142 | trace("We have " + reports.length + " diagnostic reports"); 143 | for each (var report : DiagnosticReport in reports) 144 | { 145 | trace(" ----- Log Folder = " + report.folderName + " -----"); 146 | for each (var file : String in report.logFiles) 147 | { 148 | trace(" ..... Log category = " + file + " ....."); 149 | for each (var line : String in report.getLog(file)) 150 | { 151 | trace(line); 152 | } 153 | trace(" ..... End of " + file + " log ....."); 154 | } 155 | trace(" ----- End of " + report.folderName + " report -----"); 156 | } 157 | trace(" ----- End of previous diagnostic information -----"); 158 | } 159 | _diagInfo.clearReports(); 160 | } 161 | 162 | private function setupDiagnostics() : void 163 | { 164 | // listen out for concerns - long-running functions, and errors 165 | _diagInfo.addEventListener(DiagnosticEvent.LONG_RUNNING_FUNCTION, function(e:DiagnosticEvent) : void { 166 | trace("DIAGNOSTIC LONG-RUNNING FUNCTION: " + e.description + " = " + e.metric); 167 | }); 168 | _diagInfo.addEventListener(DiagnosticEvent.ERROR_DETAILS, function(e:DiagnosticEvent) : void { 169 | trace("DIAGNOSTIC ERROR: " + e.description + " = " + e.metric); 170 | trace("Checking for a worker log file..."); 171 | var fWorker : File = _diagInfo.getLogFile("worker"); 172 | if (fWorker && fWorker.exists) trace("Log file size is " + fWorker.size); 173 | if (e.description.startsWith("Throwing ChannelClosed error")) 174 | { 175 | trace(" -- reading worker log --"); 176 | var log : Vector. = _diagInfo.getLog("worker"); 177 | if (log) for (var i : uint = 0; i < log.length; i++) trace(log[i]); 178 | trace(" -- end of worker log --"); 179 | _diagInfo.clearLog(AIRDiagnostics.DiagLogWorker); 180 | } 181 | }); 182 | } 183 | } 184 | 185 | } 186 | -------------------------------------------------------------------------------- /samples/air_diagnostics/README.md: -------------------------------------------------------------------------------- 1 | ## Sample code for AIR Diagnostics 2 | 3 | To help in debugging and identifying problems, we have created a diagnostics mechansim that is built into the 4 | AIR runtime and enabled via the use of an ANE. This sample demonstrates how to use this in order to detect 5 | an error in the runtime and to pick up a relevant diagnostic log that is being generated due to the settings 6 | provided to the Diagnostics ANE at start-up. 7 | 8 | **Note** this requires version 51.1.3.7, or later, of the AIR runtime. 9 | 10 | -------------------------------------------------------------------------------- /samples/air_diagnostics/ane/AIRDiagnostics.ane: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/ane/AIRDiagnostics.ane -------------------------------------------------------------------------------- /samples/air_diagnostics/application.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.harman.air.AIRDiagnosticsDemo 5 | 0.1 6 | mobileDevice 7 | AIRDiagnosticsDemo 8 | 9 | AIR Diagnostics Demo 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | ]]> 21 | 22 | 23 | UIStatusBarStyle 25 | UIStatusBarStyleBlackOpaque 26 | UIRequiresPersistentWiFi 27 | NO 28 | UIPrerenderedIcon 29 | 30 | UIApplicationExitsOnSuspend 31 | 32 | UIDeviceFamily 33 | 34 | 1 35 | 2 36 | 37 | ]]> 38 | high 39 | 40 | 41 | 42 | AIR Diagnostics Demo 43 | AIRDiagnosticsDemo.swf 44 | true 45 | false 46 | 47 | 48 | direct 49 | 50 | 51 | 52 | 53 | icons/icon_48.png 54 | icons/icon_57.png 55 | icons/icon_72.png 56 | icons/icon_76.png 57 | icons/icon_96.png 58 | icons/icon_114.png 59 | icons/icon_120.png 60 | icons/icon_144.png 61 | icons/icon_152.png 62 | 63 | 64 | 65 | com.harman.air.AIRDiagnostics 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_114.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_120.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_144.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_152.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_48.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_57.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_72.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_76.png -------------------------------------------------------------------------------- /samples/air_diagnostics/icons/icon_96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/air_diagnostics/icons/icon_96.png -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/TestPlayAssetDelivery.as: -------------------------------------------------------------------------------- 1 | package { 2 | 3 | import com.harman.extension.PlayAssetStatus; 4 | import com.harman.extension.PlayAssetDelivery; 5 | import com.harman.extension.PlayAssetDeliveryEvent; 6 | import com.harman.extension.AssetFile; 7 | 8 | import flash.display.Sprite; 9 | import flash.filesystem.File; 10 | import flash.filesystem.FileMode; 11 | import flash.filesystem.FileStream; 12 | import flash.system.Capabilities; 13 | import flash.system.System; 14 | import flash.text.TextField; 15 | import flash.events.Event; 16 | import flash.events.MouseEvent; 17 | 18 | 19 | public class TestPlayAssetDelivery extends Sprite { 20 | private var _ane : PlayAssetDelivery; 21 | private var _tf : TextField; 22 | private var _size : uint; 23 | private var _sInstallTime : Sprite; 24 | private var _sFastFollow : Sprite; 25 | private var _sOnDemand: Sprite; 26 | 27 | private function Trace(str : String) : void 28 | { 29 | trace(str); 30 | _tf.appendText(str); 31 | } 32 | 33 | public function TestPlayAssetDelivery() { 34 | _tf = new TextField(); 35 | _tf.text = "Starting up\n"; 36 | _tf.width = stage.stageWidth; 37 | _tf.height = stage.stageHeight; 38 | addChild(_tf); 39 | var success : Boolean = false; 40 | 41 | if (PlayAssetDelivery.isSupported) 42 | { 43 | Trace("ANE is supported\n"); 44 | _ane = new PlayAssetDelivery(); 45 | _ane.addEventListener(PlayAssetDeliveryEvent.PLAY_ASSET_UPDATE, onStatus); 46 | success = _ane.initAssetDelivery(); 47 | _ane.debugMode = true; 48 | } 49 | if (success) 50 | { 51 | // add buttons for the three types of asset pack 52 | _size = stage.stageWidth / 3; 53 | _sInstallTime = createButton(0, 0x808080); 54 | _sFastFollow = createButton(1, 0x808080); 55 | _sOnDemand = createButton(2, 0x808080); 56 | } 57 | else 58 | { 59 | Trace("FAILED TO INITIALIZE\n"); 60 | } 61 | } 62 | 63 | private function drawSprite(s : Sprite, colr : uint) : void 64 | { 65 | s.graphics.beginFill(0); 66 | s.graphics.drawRect(0, 0, _size, _size); 67 | s.graphics.endFill(); 68 | s.graphics.beginFill(colr); 69 | s.graphics.drawRect(1, 1, _size-2, _size-2); 70 | s.graphics.endFill(); 71 | } 72 | 73 | private function createButton(idx : uint, colr : uint) : Sprite 74 | { 75 | // create a sprite at the bottom of the screen (location based on this index) 76 | var s : Sprite = new Sprite(); 77 | drawSprite(s, colr); 78 | s.x = _size * idx; 79 | s.y = stage.stageHeight - _size; 80 | s.addEventListener(MouseEvent.CLICK, onClicked); 81 | addChild(s); 82 | return s; 83 | } 84 | 85 | private function onClicked(e : MouseEvent) : void 86 | { 87 | // which asset pack are we after? 88 | var strAssetPack : String; 89 | var isInstallTime : Boolean = false; 90 | var s : Sprite = e.target as Sprite; 91 | if (s == _sInstallTime) { strAssetPack = "install_time_asset_pack"; isInstallTime = true; } 92 | else if (s == _sFastFollow) strAssetPack = "fast_follow_asset_pack"; 93 | else if (s == _sOnDemand) strAssetPack = "on_demand_asset_pack"; 94 | 95 | // different APIs..! 96 | if (isInstallTime) 97 | { 98 | Trace("Checking status for install-time asset pack\n"); 99 | var af : AssetFile = _ane.openInstallTimeAsset("install_time_asset_pack_test_file.txt"); 100 | if (af && af.valid) 101 | { 102 | Trace("Asset contents: " + af.readUTFBytes(af.bytesAvailable) + "\n"); 103 | af.close(); 104 | drawSprite(s, 0x00FF00); 105 | } 106 | else 107 | { 108 | Trace("Could not read install-time asset file\n"); 109 | drawSprite(s, 0xFF0000); 110 | } 111 | } 112 | else if (strAssetPack) 113 | { 114 | Trace("Checking status for asset pack: " + strAssetPack + "\n"); 115 | if (!checkAssetPack(strAssetPack, s)) 116 | { 117 | Trace("Asset pack not found: requesting\n"); 118 | drawSprite(s, 0x000088); 119 | _ane.fetchAssetPack(strAssetPack); 120 | } 121 | } 122 | else 123 | { 124 | Trace("NO ASSET PACK SELECTION\n"); 125 | drawSprite(s, 0x202020); 126 | } 127 | } 128 | 129 | private function checkAssetPack(strAssetPack : String, s : Sprite) : Boolean 130 | { 131 | // first we get the location to see if it's there 132 | var strLocation : String = _ane.getAssetPackLocation(strAssetPack); 133 | if (strLocation) 134 | { 135 | drawSprite(s, 0x008000); 136 | Trace("Asset pack location: " + strLocation + "\n"); 137 | // now try to access a file... 138 | var strPath : String = _ane.getAssetAbsolutePath(strAssetPack, strAssetPack + "_test_file.txt"); 139 | Trace("Absolute asset path = " + strPath + "\n"); 140 | if (!strPath) 141 | { 142 | strPath = strLocation + "/" + strAssetPack + "_test_file.txt"; 143 | Trace("Manual path = " + strPath + "\n"); 144 | } 145 | var f : File = new File(strPath); 146 | if (f.exists) 147 | { 148 | Trace("File exists\n"); 149 | var fs : FileStream = new FileStream(); 150 | fs.open(f, FileMode.READ); 151 | Trace("File contents: " + fs.readUTFBytes(fs.bytesAvailable) + "\n"); 152 | fs.close(); 153 | drawSprite(s, 0x00FF00); 154 | } 155 | else 156 | { 157 | Trace("File does not exist\n"); 158 | drawSprite(s, 0x808000); 159 | } 160 | return true; 161 | } 162 | return false; 163 | } 164 | 165 | private function onStatus(e : PlayAssetDeliveryEvent) : void 166 | { 167 | Trace("Status event -> " + e.assetPackName + ", " + e.status + "\n"); 168 | var s : Sprite = null; 169 | switch (e.assetPackName) 170 | { 171 | case "install_time_asset_pack": 172 | s = _sInstallTime; 173 | break; 174 | case "fast_follow_asset_pack": 175 | s = _sFastFollow; 176 | break; 177 | case "on_demand_asset_pack": 178 | s = _sOnDemand; 179 | break; 180 | } 181 | if (s) 182 | { 183 | // check the progress 184 | switch (e.status) 185 | { 186 | case PlayAssetStatus.COMPLETED: 187 | checkAssetPack(e.assetPackName, s); 188 | break; 189 | case PlayAssetStatus.FAILED: 190 | drawSprite(s, 0xFF0000); 191 | break; 192 | case PlayAssetStatus.DOWNLOADING: 193 | var total : uint = _ane.getTotalBytesToDownLoad(e.assetPackName); 194 | var sofar : uint = _ane.getByteDownloaded(e.assetPackName); 195 | Trace("Download Progress = " + (uint)((sofar * 100) / total) + "%\n"); 196 | break; 197 | case PlayAssetStatus.TRANSFERRING: 198 | Trace("Transfer Progress = " + _ane.getTransferProgressPercentage(e.assetPackName) + "%\n"); 199 | break; 200 | } 201 | } 202 | } 203 | 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.harman.air.TestPAD 5 | 6 | TestPAD 7 | 8 | Test Play Asset Delivery 9 | 10 | 0.0.7 11 | 12 | 13 | com.harman.PlayAssetDelivery 14 | com.google.android.play 15 | 16 | 17 | 18 | TestPlayAssetDelivery.swf 19 | true 20 | true 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 49 | 53 | 57 | 58 | 59 | ]]> 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/assetpacks/fast_follow_asset_pack_files/fast_follow_asset_pack_test_file.txt: -------------------------------------------------------------------------------- 1 | File is in fast_follow_asset_pack 2 | -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/assetpacks/install_time_asset_pack_files/install_time_asset_pack_test_file.txt: -------------------------------------------------------------------------------- 1 | File is in install_time_asset_pack 2 | -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/assetpacks/on_demand_asset_pack_files/on_demand_asset_pack_test_file.txt: -------------------------------------------------------------------------------- 1 | File is in on_demand_asset_pack 2 | -------------------------------------------------------------------------------- /samples/android_play_asset_delivery/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/ane/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/ane/native/MediaBufferRender.c: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | #include 3 | #include "FlashRuntimeExtensions.h" 4 | #include 5 | #include 6 | 7 | #ifdef WIN32 8 | # define DLLEXPORT __declspec( dllexport ) 9 | # ifndef NULL 10 | # define NULL 0 11 | # endif // NULL 12 | #else // linux: need --fvisibility=hidden on the compiler command-line 13 | # define DLLEXPORT __attribute__((visibility("default"))) 14 | #endif 15 | 16 | #define FALSE 0 17 | #define TRUE 1 18 | 19 | 20 | /************************************************************** 21 | /* forward declarations of our functions 22 | /**************************************************************/ 23 | FREObject setDisplayObjectSource(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[]); 24 | FREObject startChangingMediaBuffer(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[]); 25 | void ContextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctionsToSet, const FRENamedFunction** functionsToSet); 26 | void ContextFinalizer(FREContext ctx); 27 | 28 | 29 | /************************************************************** 30 | /* main entry points 31 | /**************************************************************/ 32 | 33 | DLLEXPORT void InitExtension( 34 | void** extDataToSet , 35 | FREContextInitializer* ctxInitializerToSet, 36 | FREContextFinalizer* ctxFinalizerToSet) 37 | { 38 | *extDataToSet = NULL; 39 | *ctxInitializerToSet = ContextInitializer; 40 | *ctxFinalizerToSet = ContextFinalizer; 41 | } 42 | 43 | DLLEXPORT void DestroyExtension(void* extData) 44 | { 45 | // not actually guaranteed to be called at all.. 46 | } 47 | 48 | 49 | /************************************************************** 50 | /* context creation and destruction 51 | /**************************************************************/ 52 | 53 | void ContextInitializer( 54 | void* extData , 55 | const uint8_t* ctxType , 56 | FREContext ctx , 57 | uint32_t* numFunctionsToSet, 58 | const FRENamedFunction** functionsToSet) 59 | { 60 | static FRENamedFunction arrFunctions[] = { 61 | { (uint8_t*)"setDisplayObjectSource", NULL, setDisplayObjectSource }, 62 | { (uint8_t*)"startChangingMediaBuffer", NULL, startChangingMediaBuffer } 63 | }; 64 | *functionsToSet = arrFunctions; 65 | *numFunctionsToSet = 2; 66 | } 67 | 68 | void ContextFinalizer(FREContext ctx) 69 | { 70 | // per-object tidy-up 71 | } 72 | 73 | /************************************************************** 74 | /* setDisplayObjectSource 75 | /* Sets up the display object (arg 2) with a MediaBuffer (arg 1) 76 | /**************************************************************/ 77 | 78 | FREObject setDisplayObjectSource(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[]) 79 | { 80 | FREObject retVal = (FREObject)FRE_INVALID_OBJECT; 81 | uint32_t bSuccess = FALSE; 82 | char strTrace[1024]; 83 | sprintf_s(strTrace, 1024, "FRESetRenderSource called with %d arguments", argc); 84 | FRETrace(ctx, strTrace); 85 | 86 | if (2 == argc) 87 | { 88 | sprintf_s(strTrace, 1024, "FRESetRenderSource media buffer %p, display object %p", argv[0], argv[1]); 89 | FRETrace(ctx, strTrace); 90 | FREResult result = FRESetRenderSource(ctx, argv[0], argv[1]); 91 | sprintf_s(strTrace, 1024, "FRESetRenderSource return value was %d", result); 92 | FRETrace(ctx, strTrace); 93 | if (FRE_OK == result) bSuccess = TRUE; 94 | } 95 | FRENewObjectFromBool(bSuccess, &retVal); 96 | return retVal; 97 | } 98 | 99 | 100 | /************************************************************** 101 | /* startChangingMediaBuffer 102 | /* Sets up a thread to update the media buffer (arg 1) 103 | /**************************************************************/ 104 | 105 | FREObject startChangingMediaBuffer(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[]) 106 | { 107 | FREObject retVal = (FREObject)FRE_INVALID_OBJECT; 108 | uint32_t bSuccess = FALSE; 109 | 110 | FRETrace(ctx, "Locking media buffer..."); 111 | uint8_t* pData = NULL; 112 | uint32_t nWidth, nHeight, nStride, nFormat; 113 | FREResult result = FREMediaBufferLock(ctx, argv[0], &pData, &nWidth, &nHeight, &nStride, &nFormat); 114 | char strTrace[1024]; 115 | sprintf_s(strTrace, 1024, "FREMediaBufferLock returned %p, size %d x %d, stride %d, format %d", result, nWidth, nHeight, nStride, nFormat); 116 | FRETrace(ctx, strTrace); 117 | if (FRE_OK == result) 118 | { 119 | sprintf_s(strTrace, 1024, "FREMediaBufferLock memset %p with size %d", pData, nStride * nHeight); 120 | FRETrace(ctx, strTrace); 121 | memset(pData, 0x80, nStride * nHeight / 2); // semi-transparent grey.. 122 | FREMediaBufferUnlock(ctx, argv[0], TRUE); 123 | bSuccess = TRUE; 124 | } 125 | 126 | FRENewObjectFromBool(bSuccess, &retVal); 127 | return retVal; 128 | } 129 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/ane/swc/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | false 19 | true 20 | 51 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/ane/swc/sources/com/harman/extension/MediaBufferRender.as: -------------------------------------------------------------------------------- 1 | package com.harman.extension 2 | { 3 | import flash.external.ExtensionContext; 4 | import flash.display.Sprite; 5 | import air.media.MediaBuffer; 6 | 7 | /** MediaBufferRender */ 8 | public class MediaBufferRender 9 | { 10 | public static function setupMediaBufferRendering(mediaBuffer : MediaBuffer, sprite : Sprite) : Boolean 11 | { 12 | var success : Boolean = false; 13 | var ane : ExtensionContext = ExtensionContext.createExtensionContext("com.harman.ane.MediaBufferRender", ""); 14 | if (ane) try 15 | { 16 | success = ane.call("setDisplayObjectSource", mediaBuffer, sprite) as Boolean; 17 | } 18 | catch(e : Error) 19 | { 20 | trace("Error calling setDisplayObjectSource -> " + e.toString()); 21 | } 22 | return success; 23 | } 24 | 25 | public static function startChangingMediaBuffer(mediaBuffer : MediaBuffer) : Boolean 26 | { 27 | var success : Boolean = false; 28 | var ane : ExtensionContext = ExtensionContext.createExtensionContext("com.harman.ane.MediaBufferRender", ""); 29 | if (ane) try 30 | { 31 | success = ane.call("startChangingMediaBuffer", mediaBuffer) as Boolean; 32 | } 33 | catch(e : Error) 34 | { 35 | trace("Error calling startChangingMediaBuffer -> " + e.toString()); 36 | } 37 | return success; 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/swf/app.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.harman.air.MediaBufferRendering 5 | 6 | 7 | MediaBufferRendering 8 | 9 | 10 | Test MediaBuffer Rendering 11 | 12 | 16 | 0.0.1 17 | 18 | 19 | 20 | com.harman.ane.MediaBufferRender 21 | 22 | extendedDesktop 23 | 24 | 25 | 26 | MediaBufferRender.swf 27 | true 28 | true 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/swf/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | true 21 | true 22 | 51 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/swf/src/com/harman/air/MediaBufferRender.as: -------------------------------------------------------------------------------- 1 | package com.harman.air 2 | { 3 | import flash.display.Sprite; 4 | import flash.events.Event; 5 | import flash.utils.setTimeout; 6 | import flash.utils.setInterval; 7 | import air.media.MediaBuffer; 8 | import com.harman.extension.MediaBufferRender; 9 | 10 | public class MediaBufferRender extends Sprite 11 | { 12 | private var _angle : Number = 0.0; 13 | private var _s1 : Sprite; 14 | private var _s2 : Sprite; 15 | private var _s3 : Sprite; 16 | private var _buffer : MediaBuffer; 17 | 18 | [Embed(source="../../../harman-logo.png")] 19 | private var HarmanLogo : Class; 20 | 21 | public function MediaBufferRender() 22 | { 23 | // set up three sprites and have them rotate 24 | _s1 = createSprite(100, 100, 0xff0000); 25 | _s2 = createSprite(200, 200, 0x00ff00); 26 | _s3 = createSprite(300, 300, 0x0000ff); 27 | //setInterval(rotateSprites, 1000); 28 | addEventListener(Event.ENTER_FRAME, rotateSprites); 29 | 30 | // create a media buffer object 31 | _buffer = MediaBuffer.createFromResource(HarmanLogo); 32 | setTimeout(setupMediaBuffer, 5000); 33 | } 34 | 35 | private function setupMediaBuffer() : void 36 | { 37 | // create the ANE and set up the media buffer as the target for sprite 2 38 | var bSuccess : Boolean = com.harman.extension.MediaBufferRender.setupMediaBufferRendering(_buffer, _s2); 39 | trace("Configured media buffer for sprite, success = " + bSuccess); 40 | setTimeout(startChangingMediaBuffer, 5000); 41 | } 42 | 43 | private function startChangingMediaBuffer() : void 44 | { 45 | // create the ANE and set up the media buffer as the target for sprite 2 46 | var bSuccess : Boolean = com.harman.extension.MediaBufferRender.startChangingMediaBuffer(_buffer); 47 | trace("Started thread to alter media buffer, success = " + bSuccess); 48 | } 49 | 50 | private function createSprite(aX : uint, aY : uint, colr : uint) : Sprite 51 | { 52 | var s : Sprite = new Sprite(); 53 | s.graphics.beginFill(colr); 54 | s.graphics.drawRect(0, 0, 200, 200); 55 | s.graphics.endFill(); 56 | s.x = aX; 57 | s.y = aY; 58 | addChild(s); 59 | return s; 60 | } 61 | 62 | private function rotateSprites(e: Event = null) : void 63 | { 64 | trace("Rotating to " + _angle); 65 | _s1.rotation = _s2.rotation = _s3.rotation = _angle; 66 | _angle += 5; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /samples/mediabuffer_rendering/swf/src/harman-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/airsdk/Adobe-Runtime-Support/a9de275e5574d2da8af0555550637d755eea07c8/samples/mediabuffer_rendering/swf/src/harman-logo.png --------------------------------------------------------------------------------