documenting and remove soe direcotry.

This commit is contained in:
shogo4405 2021-04-11 17:25:47 +09:00
parent d9e3bc4797
commit b6e08eb6a9
14 changed files with 10 additions and 466 deletions

View File

@ -1,9 +1,7 @@
import AVFoundation
import Foundation
/**
flash.net.Responder for Swift
*/
/// flash.net.Responder for Swift
open class Responder {
public typealias Handler = (_ data: [Any?]) -> Void
@ -26,9 +24,7 @@ open class Responder {
}
// MARK: -
/**
flash.net.NetConnection for Swift
*/
/// flash.net.NetConnection for Swift
open class RTMPConnection: EventDispatcher {
public static let defaultWindowSizeS: Int64 = 250000
public static let supportedProtocols: Set<String> = ["rtmp", "rtmps", "rtmpt", "rtmpts"]
@ -255,9 +251,7 @@ open class RTMPConnection: EventDispatcher {
removeEventListener(.rtmpStatus, selector: #selector(on(status:)))
}
/**
Calls a command or method on RTMP Server.
*/
/// Calls a command or method on RTMP Server.
open func call(_ commandName: String, responder: Responder?, arguments: Any?...) {
guard connected else {
return
@ -277,9 +271,7 @@ open class RTMPConnection: EventDispatcher {
socket.doOutput(chunk: RTMPChunk(message: message), locked: nil)
}
/**
Creates a two-way connection to an application on RTMP Server.
*/
/// Creates a two-way connection to an application on RTMP Server.
open func connect(_ command: String, arguments: Any?...) {
guard let uri = URL(string: command), let scheme: String = uri.scheme, !connected && Self.supportedProtocols.contains(scheme) else {
return
@ -304,9 +296,7 @@ open class RTMPConnection: EventDispatcher {
socket.connect(withName: uri.host!, port: uri.port ?? (secure ? Self.defaultSecurePort : Self.defaultPort))
}
/**
Closes the connection from the server.
*/
/// Closes the connection from the server.
open func close() {
close(isDisconnected: false)
}

View File

@ -336,6 +336,7 @@ open class RTMPStream: NetStream {
rtmpConnection.removeEventListener(.rtmpStatus, selector: #selector(on(status:)), observer: self)
}
/// Plays a live stream from RTMPServer.
open func play(_ arguments: Any?...) {
lockQueue.async {
guard let name: String = arguments.first as? String else {
@ -378,6 +379,7 @@ open class RTMPStream: NetStream {
}
}
/// Seeks the keyframe.
open func seek(_ offset: Double) {
lockQueue.async {
guard self.readyState == .playing else {
@ -394,6 +396,7 @@ open class RTMPStream: NetStream {
}
}
/// Sends streaming audio, vidoe and data message from client.
open func publish(_ name: String?, type: RTMPStream.HowToPublish = .live) {
lockQueue.async {
guard let name: String = name else {
@ -451,6 +454,7 @@ open class RTMPStream: NetStream {
}
}
/// Stops playing or publishing and makes available other uses.
open func close() {
if readyState == .closed {
return
@ -475,6 +479,7 @@ open class RTMPStream: NetStream {
}
}
/// Sends a message on a published stream to all subscribing clients.
open func send(handlerName: String, arguments: Any?...) {
lockQueue.async {
if self.readyState == .closed {

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<application xmlns="http://ns.adobe.com/air/application/3.9">
<id>soe</id>
<versionNumber>1.0</versionNumber>
<filename>soe</filename>
<name>SharedObjectExplorer</name>
<description></description>
<copyright></copyright>
<initialWindow>
<title>soe</title>
<content>soe.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<minimizable>true</minimizable>
<maximizable>true</maximizable>
<resizable>true</resizable>
</initialWindow>
</application>

View File

@ -1,34 +0,0 @@
@echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
:: Generate
echo.
echo Generating a self-signed certificate...
call adt -certificate -cn %CERT_NAME% 2048-RSA %CERT_FILE% %CERT_PASS%
if errorlevel 1 goto failed
:succeed
echo.
echo Certificate created: %CERT_FILE% with password "%CERT_PASS%"
echo.
if "%CERT_PASS%" == "fd" echo Note: You did not change the default password
echo.
echo HINTS:
echo - you only need to generate this certificate once,
echo - wait a minute before using this certificate to package your AIR application.
echo.
goto end
:failed
echo.
echo Certificate creation FAILED.
echo.
:end
pause

View File

@ -1,15 +0,0 @@
@echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
set AIR_TARGET=
::set AIR_TARGET=-captive-runtime
set OPTIONS=-tsa none
call bat\Packager.bat
pause

View File

@ -1,39 +0,0 @@
@echo off
:: Set working dir
cd %~dp0 & cd ..
if not exist %CERT_FILE% goto certificate
:: AIR output
if not exist %AIR_PATH% md %AIR_PATH%
set OUTPUT=%AIR_PATH%\%AIR_NAME%%AIR_TARGET%.air
:: Package
echo.
echo Packaging %AIR_NAME%%AIR_TARGET%.air using certificate %CERT_FILE%...
call adt -package %OPTIONS% %SIGNING_OPTIONS% %OUTPUT% %APP_XML% %FILE_OR_DIR%
if errorlevel 1 goto failed
goto end
:certificate
echo.
echo Certificate not found: %CERT_FILE%
echo.
echo Troubleshooting:
echo - generate a default certificate using 'bat\CreateCertificate.bat'
echo.
if %PAUSE_ERRORS%==1 pause
exit
:failed
echo AIR setup creation FAILED.
echo.
echo Troubleshooting:
echo - verify AIR SDK target version in %APP_XML%
echo.
if %PAUSE_ERRORS%==1 pause
exit
:end
echo.

View File

@ -1,21 +0,0 @@
@echo off
:: Set working dir
cd %~dp0 & cd ..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApp.bat
echo.
echo Starting AIR Debug Launcher...
echo.
adl "%APP_XML%" "%APP_DIR%"
if errorlevel 1 goto error
goto end
:error
pause
:end

View File

@ -1,47 +0,0 @@
:: Set working dir
cd %~dp0 & cd ..
:user_configuration
:: About AIR application packaging
:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515
:: NOTICE: all paths are relative to project root
:: Your certificate information
set CERT_NAME="soe"
set CERT_PASS=fd
set CERT_FILE="bat\soe.p12"
set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERT_FILE% -storepass %CERT_PASS%
:: Application descriptor
set APP_XML=application.xml
:: Files to package
set APP_DIR=bin
set FILE_OR_DIR=-C %APP_DIR% .
:: Your application ID (must match <id> of Application descriptor) and remove spaces
for /f "tokens=3 delims=<>" %%a in ('findstr /R /C:"^[ ]*<id>" %APP_XML%') do set APP_ID=%%a
set APP_ID=%APP_ID: =%
:: Output
set AIR_PATH=air
set AIR_NAME=soe
:validation
findstr /C:"<id>%APP_ID%</id>" "%APP_XML%" > NUL
if errorlevel 1 goto badid
goto end
:badid
echo.
echo ERROR:
echo Application ID in 'bat\SetupApp.bat' (APP_ID)
echo does NOT match Application descriptor '%APP_XML%' (id)
echo.
if %PAUSE_ERRORS%==1 pause
exit
:end

View File

@ -1,26 +0,0 @@
:: Set working dir
cd %~dp0 & cd ..
:user_configuration
:: Static path to Flex SDK
set FLEX_SDK=C:\Program Files (x86)\FlashDevelop\Tools\flexsdk
:: Use FD supplied SDK path if executed from FD
if exist "%FD_CUR_SDK%" set FLEX_SDK=%FD_CUR_SDK%
:validation
if not exist "%FLEX_SDK%\bin" goto flexsdk
goto succeed
:flexsdk
echo.
echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
echo.
echo Looking for: %FLEX_SDK%\bin
echo.
if %PAUSE_ERRORS%==1 pause
exit
:succeed
set PATH=%FLEX_SDK%\bin;%PATH%

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<project version="2">
<!-- Output SWF options -->
<output>
<movie outputType="Application" />
<movie input="" />
<movie path="bin\soe.swf" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
<movie version="3" />
<movie minorVersion="9" />
<movie platform="AIR" />
<movie background="#FFFFFF" />
</output>
<!-- Other classes to be compiled into your SWF -->
<classpaths>
<class path="src" />
</classpaths>
<!-- Build options -->
<build>
<option accessible="False" />
<option advancedTelemetry="False" />
<option allowSourcePathOverlap="False" />
<option benchmark="False" />
<option es="False" />
<option inline="False" />
<option locale="" />
<option loadConfig="" />
<option optimize="True" />
<option omitTraces="True" />
<option showActionScriptWarnings="True" />
<option showBindingWarnings="True" />
<option showInvalidCSS="True" />
<option showDeprecationWarnings="True" />
<option showUnusedTypeSelectorWarnings="True" />
<option strict="True" />
<option useNetwork="True" />
<option useResourceBundleMetadata="True" />
<option warnings="True" />
<option verboseStackTraces="False" />
<option linkReport="" />
<option loadExterns="" />
<option staticLinkRSL="True" />
<option additional="" />
<option compilerConstants="" />
<option minorVersion="" />
</build>
<!-- SWC Include Libraries -->
<includeLibraries>
<!-- example: <element path="..." /> -->
</includeLibraries>
<!-- SWC Libraries -->
<libraryPaths>
<!-- example: <element path="..." /> -->
</libraryPaths>
<!-- External Libraries -->
<externalLibraryPaths>
<!-- example: <element path="..." /> -->
</externalLibraryPaths>
<!-- Runtime Shared Libraries -->
<rslPaths>
<!-- example: <element path="..." /> -->
</rslPaths>
<!-- Intrinsic Libraries -->
<intrinsics>
<element path="Library\AS3\frameworks\Flex4" />
</intrinsics>
<!-- Assets to embed into the output SWF -->
<library>
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
</library>
<!-- Class files to compile (other referenced classes will automatically be included) -->
<compileTargets>
<compile path="src\Main.mxml" />
</compileTargets>
<!-- Paths to exclude from the Project Explorer tree -->
<hiddenPaths>
<hidden path="obj" />
</hiddenPaths>
<!-- Executed before build -->
<preBuildCommand />
<!-- Executed after build -->
<postBuildCommand alwaysRun="False" />
<!-- Other project options -->
<options>
<option showHiddenPaths="False" />
<option testMovie="Custom" />
<option testMovieCommand="bat\RunApp.bat" />
</options>
<!-- Plugin storage -->
<storage />
</project>

View File

@ -1,12 +0,0 @@
package
{
public class Hoge
{
public var hoge:String = "hoge"
public var kani:String = "kani"
public function Hoge()
{
}
}
}

View File

@ -1,18 +0,0 @@
<?xml version="1.0"?>
<flex-config>
<compiler>
<locale>
<locale-element>ja_JP</locale-element>
</locale>
<source-path append="true">
<path-element>../src</path-element>
</source-path>
<namespaces append="true">
<namespace>
<uri>library://ns.adobe.com/flex/spark</uri>
<manifest>${flexlib}/spark-manifest.xml</manifest>
</namespace>
</namespaces>
</compiler>
<default-background-color>#FFFFFF</default-background-color>
</flex-config>

View File

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%"
>
<fx:Script>
<![CDATA[
import flash.events.NetStatusEvent;
import flash.net.NetConnection;
import flash.net.registerClassAlias;
import flash.net.SharedObject;
import flash.events.MouseEvent;
import flash.events.SyncEvent;
import flash.xml.XMLDocument;
import mx.utils.ObjectUtil;
private var connection:NetConnection = null;
private var sharedObject:SharedObject = null;
registerClassAlias("foo.bar.Hoge", Hoge);
private function idConnectButton_clickHandler(e:MouseEvent):void {
if (connection != null) {
if (sharedObject != null) {
sharedObject.removeEventListener(SyncEvent.SYNC, sharedObject_syncHandler);
sharedObject = null
}
connection.removeEventListener(NetStatusEvent.NET_STATUS, connection_netStatusHandler);
connection = null;
}
connection = new NetConnection();
connection.objectEncoding = Number(idOjectEncodingRadioButtonGroup.selectedValue)
trace(connection.objectEncoding)
connection.client = new NetClient();
connection.addEventListener(NetStatusEvent.NET_STATUS, connection_netStatusHandler);
connection.connect(idRTMPTextInput.text);
}
private function connection_netStatusHandler(e:NetStatusEvent):void {
switch (e.info["code"]) {
case "NetConnection.Connect.Success":
sharedObject = SharedObject.getRemote(idSharedObjectNameTextInput.text, connection.uri, false);
sharedObject.addEventListener(SyncEvent.SYNC, sharedObject_syncHandler);
sharedObject.connect(connection);
break;
default:
break;
}
}
private function sharedObject_syncHandler(e:SyncEvent):void {
idDumpTextArea.text = ObjectUtil.toString(sharedObject.data)
idEventDumpTextArea.text = ObjectUtil.toString(e.changeList).replace(/\r?\n/g, "") + "\n" + idEventDumpTextArea.text;
}
]]>
</fx:Script>
<fx:Declarations>
<s:RadioButtonGroup selectedValue="3" id="idOjectEncodingRadioButtonGroup" />
</fx:Declarations>
<s:layout>
<s:VerticalLayout gap="0" />
</s:layout>
<s:HGroup width="100%" paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10">
<mx:Form width="100%" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0">
<mx:FormItem label="RTMP" width="100%" >
<s:TextInput id="idRTMPTextInput" text="rtmp://localhost/test" width="100%" />
</mx:FormItem>
<mx:FormItem label="SharedObjectName" width="100%" >
<s:TextInput id="idSharedObjectNameTextInput" text="test" width="100%"/>
</mx:FormItem>
<mx:FormItem label="objectEncoding" width="100%" >
<s:RadioButton group="{idOjectEncodingRadioButtonGroup}" id="idAMF0RadioButton" value="0" label="AMF0" />
<s:RadioButton group="{idOjectEncodingRadioButtonGroup}" id="idAMF3RadioButton" value="3" label="AMF3" />
</mx:FormItem>
</mx:Form>
<s:Button width="20%" height="100%" id="idConnectButton" click="idConnectButton_clickHandler(event)" label="connect" />
</s:HGroup>
<s:HGroup width="100%" height="100%">
<s:VGroup width="80%" height="100%">
<s:TextArea id="idDumpTextArea" width="100%" height="100%" />
<s:TextArea id="idEventDumpTextArea" width="100%" height="120" />
</s:VGroup>
<s:VGroup width="20%" height="100%">
<s:Button width="100%" height="30" click="sharedObject.setProperty('Undefined', [undefined]);" label="Undefined" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('Null', [null]);" label="Null" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('BoolFalse', false);" label="BoolFalse" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('BoolTrue', true);" label="BoolTrue" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('Integer', int.MIN_VALUE);" label="Integer" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('TypedObject', new Hoge());" label="TypedObject" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('Number', Number.MAX_VALUE);" label="Number" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('String', 'Hello World!!');" label="String" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('Xml', new XMLDocument('&lt;a&gt;hoge&lt;/a&gt;'));" label="Xml(flash.xml.XMLDocument)" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('Date', new Date());" label="Date" />
<s:Button width="100%" height="30" click="var a:Array = [0, 1, 'hello', '3']; a.hoge = 100; sharedObject.setProperty('Array', a);" label="Array" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('ArrayComplex', [0, 1, 'hello', [0, 1, 2], {'foo':'bar'}]);" label="Array(Complex)" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('ArrayComplex', null);" label="Array(Complex) - Remove" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('XmlString', new XML('&lt;a&gt;hoge&lt;/a&gt;'));" label="XmlString(XML)" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('VectorInt', new &lt;int&gt;[0, -1, int.MIN_VALUE,]);" label="VectorInt" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('VectorUInt', new &lt;uint&gt;[0, 1, 2,]);" label="VectorUInt" />
<s:Button width="100%" height="30" click="sharedObject.setProperty('VectorNumber', new &lt;Number&gt;[0, -1, 2,]);" label="VectorNumber" />
<s:Button width="100%" height="30" click="var d:Dictionary = new Dictionary(); d.kani = 'kani'; sharedObject.setProperty('Dictionary', d);" label="Dictionary" />
</s:VGroup>
</s:HGroup>
</s:WindowedApplication>

View File

@ -1,11 +0,0 @@
package
{
import mx.utils.ObjectProxy;
public dynamic class NetClient extends ObjectProxy
{
public function NetClient()
{
}
}
}