> **Experimental**
>
> `@aws-cdk/aws-mediapackagev2-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# TsEncryptionMethod

Encryption methods for TS container type.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/endpoint.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-mediapackagev2-alpha/lib/endpoint.ts#L806)

## Example

TypeScript:

```ts
declare const channel: Channel;
declare const spekeRole: iam.IRole;

new OriginEndpoint(this, 'TsEndpoint', {
  channel,
  segment: Segment.ts({
    encryption: TsEncryption.speke({
      method: TsEncryptionMethod.SAMPLE_AES,
      resourceId: 'my-content-id',
      url: 'https://example.com/speke',
      role: spekeRole,
    }),
  }),
  manifests: [Manifest.hls({ manifestName: 'index' })],
});
```

Python:

```python
# channel: Channel
# speke_role: iam.IRole

OriginEndpoint(self, "TsEndpoint",
    channel=channel,
    segment=Segment.ts(
        encryption=TsEncryption.speke(
            method=TsEncryptionMethod.SAMPLE_AES,
            resource_id="my-content-id",
            url="https://example.com/speke",
            role=speke_role
        )
    ),
    manifests=[Manifest.hls(manifest_name="index")]
)
```

Java:

```java
Channel channel;
IRole spekeRole;

OriginEndpoint.Builder.create(this, "TsEndpoint")
        .channel(channel)
        .segment(Segment.ts(TsSegmentProps.builder()
                .encryption(TsEncryption.speke(TsSpekeEncryptionProps.builder()
                        .method(TsEncryptionMethod.SAMPLE_AES)
                        .resourceId("my-content-id")
                        .url("https://example.com/speke")
                        .role(spekeRole)
                        .build()))
                .build()))
        .manifests(List.of(Manifest.hls(HlsManifestConfiguration.builder().manifestName("index").build())))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.MediaPackageV2.Alpha
Channel channel;
IRole spekeRole;

new OriginEndpoint(this, "TsEndpoint", new OriginEndpointProps {
    Channel = channel,
    Segment = Segment.Ts(new TsSegmentProps {
        Encryption = TsEncryption.Speke(new TsSpekeEncryptionProps {
            Method = TsEncryptionMethod.SAMPLE_AES,
            ResourceId = "my-content-id",
            Url = "https://example.com/speke",
            Role = spekeRole
        })
    }),
    Manifests = new [] { Manifest.Hls(new HlsManifestConfiguration { ManifestName = "index" }) }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsmediapackagev2alpha/v2
var channel Channel
var spekeRole IRole

awsmediapackagev2alpha.NewOriginEndpoint(this, jsii.String("TsEndpoint"), &OriginEndpointProps{
	Channel: Channel,
	Segment: awsmediapackagev2alpha.Segment_Ts(&TsSegmentProps{
		Encryption: awsmediapackagev2alpha.TsEncryption_Speke(&TsSpekeEncryptionProps{
			Method: awsmediapackagev2alpha.TsEncryptionMethod_SAMPLE_AES,
			ResourceId: jsii.String("my-content-id"),
			Url: jsii.String("https://example.com/speke"),
			Role: spekeRole,
		}),
	}),
	Manifests: []Manifest{
		awsmediapackagev2alpha.Manifest_Hls(&HlsManifestConfiguration{
			ManifestName: jsii.String("index"),
		}),
	},
})
```

## Members

| Member | Description |
| --- | --- |
| `AES_128` | AES-128 encryption - requires Clear Key AES 128 DRM system. |
| `SAMPLE_AES` | Sample-level AES encryption - requires FairPlay DRM system. |

## Referenced by

- [`TsSpekeEncryptionProps`](/v2/docs/@aws-cdk_aws-mediapackagev2-alpha.TsSpekeEncryptionProps).method
