amplify-video icon indicating copy to clipboard operation
amplify-video copied to clipboard

Write configuration compatible with Amplify Android

Open alextyner opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently, no matter the platform, the same minimal configuration file is generated. For the configuration file to be most useful to a frontend developer, including more information is necessary.

Describe the solution you'd like In parallel with Amplify CLI's amplifyconfiguration.json, write configuration to videoconfiguration.json for Android environments.

Note: In amplify-cli, the configuration file for JavaScript environments is formatted entirely differently and uses an EJS template instead.

On Android, as amplify-cli does, this file should default to the location ${PROJECT}/app/src/main/res/raw/videoconfiguration.json.

Format the configuration something like:

% cat app/src/main/res/raw/videoconfiguration.json 
{
    "video": {
        "plugins": {
            "awsVideoPlugin": {
                "myvodstreams": {
                    "type": "ON_DEMAND",
                    "input": "myvodstreams-dev-input-***",
                    "output": "myvodstreams-dev-output-***.s3.us-east-1.amazonaws.com"
                },
                "mytestlivestream": {
                    "type": "LIVE",
                    "ingress": {
                        "primary": "udp://***:5000",
                        "backup": "udp://***:5000"
                    },
                    "egress": {
                        "mediastore": "https://***.data.mediastore.us-east-1.amazonaws.com/p/index.m3u8"
                        /* OTHER EGRESS TYPES HERE AS APPLICABLE */
                    }
                }
            }
        }
    }
}

Here is an example amplifyconfiguration.json with multiple plugins generated by amplify-cli for comparison:

% cat app/src/main/res/raw/amplifyconfiguration.json
{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:***",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_***",
                        "AppClientId": "***",
                        "AppClientSecret": "***",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "authenticationFlowType": "USER_SRP_AUTH"
                    }
                },
                "AppSync": {
                    "Default": {
                        "ApiUrl": "https://***api.appsync-api.us-east-1.amazonaws.com/graphql",
                        "Region": "us-east-1",
                        "AuthMode": "API_KEY",
                        "ApiKey": "***",
                        "ClientDatabasePrefix": "myapplication_API_KEY"
                    }
                }
            }
        }
    },
    "api": {
        "plugins": {
            "awsAPIPlugin": {
                "myapplication": {
                    "endpointType": "GraphQL",
                    "endpoint": "https://***.appsync-api.us-east-1.amazonaws.com/graphql",
                    "region": "us-east-1",
                    "authorizationType": "API_KEY",
                    "apiKey": "***"
                }
            }
        }
    }
}

The amplify-cli implementation of this feature can be seen for various categories here.

Describe alternatives you've considered In the JSON for videoconfiguration above, the video resources could be grouped by their type (Live/VoD) rather than contain an enumerated type.

Additional context The same format could be re-used for iOS, and it appears to be identical in amplify-cli. However, the file location is different on iOS.

alextyner avatar Jul 07 '20 20:07 alextyner