in provider-utils/awscloudformation/utils/video-getinfo.js [30:94]
async function generateAWSExportsVideo(context) {
const projectConfig = context.amplify.getProjectConfig();
const projectMeta = context.amplify.getProjectMeta();
const targetDir = context.amplify.pathManager.getBackendDirPath();
const props = {};
let filePath = '';
if (projectConfig.frontend === 'ios') {
filePath = './aws-video-exports.json';
} else if (projectConfig.frontend === 'android') {
filePath = `./${projectConfig.android.config.ResDir}/aws-video-exports.json`;
} else if (projectConfig.frontend === 'javascript') {
filePath = `./${projectConfig.javascript.config.SourceDir}/aws-video-exports.js`;
} else {
// Default location in json. Worst case scenario
filePath = './aws-video-exports.json';
}
if ('video' in projectMeta && Object.keys(projectMeta.video).length !== 0) {
Object.entries(projectMeta.video).forEach((videoMeta) => {
const [projectName, project] = videoMeta;
const videoConfig = JSON.parse(fs.readFileSync(`${targetDir}/video/${projectName}/props.json`));
if ('output' in project) {
const { output } = project;
if (project.serviceType === 'video-on-demand') {
props.awsInputVideo = output.oVODInputS3;
props.awsOutputVideo = output.oVodOutputUrl;
props.protectedURLS = videoConfig.signedKey;
} else if (project.serviceType === 'livestream') {
if (output.oPrimaryHlsEgress) {
props.awsOutputLiveHLS = output.oPrimaryHlsEgress;
}
if (output.oPrimaryDashEgress) {
props.awsOutputLiveDash = output.oPrimaryDashEgress;
}
if (output.oPrimaryMssEgress) {
props.awsOutputLiveMss = output.oPrimaryMssEgress;
}
if (output.oPrimaryCmafEgress) {
props.awsOutputLiveCmaf = output.oPrimaryCmafEgress;
}
if (output.oMediaStoreContainerName) {
props.awsOutputLiveLL = output.oPrimaryMediaStoreEgressUrl;
}
} else if (project.serviceType === 'ivs') {
props.awsOutputIVS = output.oVideoOutput;
}
}
});
if (projectConfig.frontend === 'javascript') {
const copyJobs = [
{
dir: __dirname,
template: 'exports-templates/aws-video-exports.js.ejs',
target: filePath,
},
];
await context.amplify.copyBatch(context, copyJobs, props, true);
} else {
fs.writeFileSync(filePath, JSON.stringify(props, null, 4));
}
}
}