Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

awscdk-construct-mediapackage-wrapper

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awscdk-construct-mediapackage-wrapper

CDK Construct for creating wrapper Lambda@Edge functions for MediaPackage endpoints

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
0
Weekly downloads
 
Created
Source

awscdk-construct-mediapackage-wrapper

View on Construct Hub

CDK Construct for creating wrapper Lambda@Edge functions for MediaPackage endpoints

  • You can define two Lambda@Edge functions, each intended for manipulating HLS and DASH manifest
  • Each function needs to be stored in a TypeScript (.ts) file and its path needs to be passed
  • The created Lambda@Edge functions will be set as ORIGIN_REQUEST triggers of a newly created CloudFront distribution

Input:

  • MediaPackage's domain name
  • The relative path to the TypeScript file containing the Lambda@Edge function for manipulating HLS manifest
  • The relative path to the TypeScript file containing the Lambda@Edge function for manipulating DASH manifest Output:
  • Lambda@Edge functions
  • CloudFront distribution with associated with the Lambda@Edge functions

Install

NPM

Usage

import { Stack, StackProps, CfnOutput, Fn } from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/lambda';
import { Construct } from 'constructs';
import { LiveChannelFromMp4 } from 'awscdk-construct-live-channel-from-mp4-file';
import { Wrapper } from 'awscdk-construct-mediapackage-wrapper';

export class ExampleStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // Create a live channel (MediaLive + MediaPackage)
    const {empv1: emp} = new LiveChannelFromMp4(this, 'LiveChannelFromMp4', {
      sourceUrl: 's3ssl://example_bucket/test.mp4',
      timecodeBurninPrefix: 'Ch1',
      autoStart: true,
      mediaPackageVersionSpec: 'V1_ONLY',
    });

    const hlsArr = Fn.split('/', emp.endpoints.hls.attrUrl);
    const dashArr = Fn.split('/', emp.endpoints.dash.attrUrl);

    // Create wrapper L@E functions
    const wrapper = new Wrapper(stack, 'Wrapper', {
      domainName: Fn.select(2, hlsArr),
      hlsWrapperFunction: lambda.Code.fromAsset('./func/hls/')),
      dashWrapperFunction: lambda.Code.fromAsset('./func/dash/')),
    });

    // Print MediaPackage endpoint URL (HLS)
    new CfnOutput(this, "WrappedHLSEndpointURL", {
      value: `https://${wrapper.cf.distribution.distributionDomainName}/out/v1/${Fn.select(5, hlsArr)}/${Fn.select(6, hlsArr)}`,
      exportName: "WrappedHLSEndpointURL",
      description: "HLS endpoint URL",
    });

    // Print MediaPackage endpoint URL (DASH)
    new CfnOutput(this, "WrappedDASHEndpointURL", {
      value: `https://${wrapper.cf.distribution.distributionDomainName}/out/v1/${Fn.select(5, dashArr)}/${Fn.select(6, dashArr)}`,
      exportName: "WrappedDASHEndpointURL",
      description: "DASH endpoint URL",
    });
  }
}

Keywords

FAQs

Package last updated on 06 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc