> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 스트림 블루프린트

> 비디오, 오디오, 라이브 스트림 및 실시간 데이터 전송 청구를 위한 스트리밍 데이터 소비를 추적합니다.

## 사용 사례

스트림 블루프린트에서 지원하는 일반적인 시나리오를 탐색하세요:

<CardGroup cols={2}>
  <Card title="Video Platforms" icon="video">
    비디오 대역폭 소비 및 스트리밍 품질에 따라 고객에게 청구합니다.
  </Card>

  <Card title="Music Streaming" icon="music">
    구독 등급별로 사용자당 오디오 스트리밍 사용량을 추적합니다.
  </Card>

  <Card title="Live Events" icon="signal-stream">
    라이브 스트림 소비를 모니터링하고 대역폭 사용량에 따라 요금을 부과합니다.
  </Card>

  <Card title="Real-Time Data" icon="wave-pulse">
    IoT 및 원격측정 애플리케이션의 실시간 데이터 전송을 추적합니다.
  </Card>
</CardGroup>

<Info>
  비디오/오디오 스트리밍 플랫폼, 라이브 스트리밍 서비스 및 실시간 데이터 애플리케이션에 적합합니다.
</Info>

## 빠른 시작

고객이 소비한 스트리밍 바이트를 추적하세요:

<Steps>
  <Step title="Install the SDK">
    ```bash theme={null}
    npm install @dodopayments/ingestion-blueprints
    ```
  </Step>

  <Step title="Get Your API Keys">
    * **Dodo Payments API Key**: [Dodo Payments Dashboard](https://app.dodopayments.com/developer/api-keys)에서 가져옵니다.
  </Step>

  <Step title="Create a Meter">
    [Dodo Payments Dashboard](https://app.dodopayments.com/)에서 미터를 생성합니다:

    * **Event Name**: `stream_consumption` (또는 원하는 이름)
    * **Aggregation Type**: `sum`을 사용하여 스트리밍된 총 바이트를 추적합니다
    * **Over Property**: `bytes`을 사용하여 대역폭 사용량 기준으로 청구합니다
  </Step>

  <Step title="Track Stream Usage">
    <CodeGroup>
      ```javascript Video Streaming theme={null}
      import { Ingestion, trackStreamBytes } from '@dodopayments/ingestion-blueprints';

      const ingestion = new Ingestion({
        apiKey: process.env.DODO_PAYMENTS_API_KEY,
        environment: 'test_mode',
        eventName: 'stream_consumption'
      });

      // Track video stream consumption
      await trackStreamBytes(ingestion, {
        customerId: 'customer_123',
        bytes: 10485760, // 10MB
        metadata: {
          stream_type: 'video',
        }
      });
      ```
    </CodeGroup>
  </Step>
</Steps>

## 구성

### 수집 구성

<ParamField path="apiKey" type="string" required>
  대시보드에서 가져온 Dodo Payments API 키입니다.
</ParamField>

<ParamField path="environment" type="string" required>
  환경 모드: `test_mode` 또는 `live_mode`.
</ParamField>

<ParamField path="eventName" type="string" required>
  미터 구성과 일치하는 이벤트 이름입니다.
</ParamField>

### 스트림 바이트 추적 옵션

<ParamField path="customerId" type="string" required>
  청구 귀속을 위한 고객 ID입니다.
</ParamField>

<ParamField path="bytes" type="number">
  스트림에서 소비된 바이트 수입니다. 대역폭 기반 청구에 필요합니다.
</ParamField>

<ParamField path="metadata" type="object">
  스트림 유형, 품질, sessionId 등 스트림에 대한 선택적 메타데이터입니다.
</ParamField>

## 모범 사례

<Tip>
  **Track by Chunk**: 긴 스트림의 경우 전체 스트림 완료를 기다리지 않고 청취량을 청크 단위로 추적하세요.
</Tip>

<Warning>
  **Accurate Byte Counting**: 총 대역폭을 기준으로 청구할 경우 모든 오버헤드(헤더, 프로토콜 오버헤드)를 포함하여 바이트 수를 계산하세요.
</Warning>
