# OptiView Real-time Streaming

Tip: open your browser's developer console and use the `player` and `THEOplayer` variables to interact with this demo.

[OptiView Real-time Streaming](https://docs-preview.optiview.dolby.com/pr-912/millicast/getting-started.md) (formerly Millicast) delivers real-time streaming with sub-second latency over WebRTC. THEOplayer can subscribe to an OptiView Real-time stream directly: set the source `type` to `"millicast"` and provide the stream name (`src`) and account identifier (`streamAccountId`).

```js
player.source = {
  sources: {
    type: 'millicast',
    src: 'multiview',
    streamAccountId: 'k9Mwad',
    // subscriberToken: '...' // for secure streams
  },
};
```

See the [`MillicastSource`](https://docs-preview.optiview.dolby.com/pr-912/theoplayer/v11/api-reference/web/interfaces/MillicastSource) API reference for all available fields, including `subscriberToken` for secure streams.

Code

demo.html

```html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>OptiView Real-time Streaming</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet" />
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
      }

      theoplayer-default-ui:not(:defined) {
        display: inline-block;
        box-sizing: border-box;
      }

      theoplayer-default-ui {
        width: 100%;
        aspect-ratio: 16 / 9;
        font-family: 'Noto Sans', sans-serif;
        background: #000;
      }
    </style>
    <script src="https://cdn.theoplayer.com/dash/theoplayer/THEOplayer.js"></script>
    <script nomodule src="https://unpkg.com/@theoplayer/web-ui@2/polyfills"></script>
    <script async src="https://unpkg.com/@theoplayer/web-ui@2"></script>
  </head>
  <body>
    <!--
      libraryLocation: For demonstration purposes, we use the THEOplayer CDN.
      For production use, host the library yourself and update this URL and the script above.

      licenseUrl: Point this to your license file, or replace it with a license property.

      An OptiView Real-time Streaming live source: 'src' is the stream name, 'streamAccountId' the account.
      Secure streams also need a 'subscriberToken'.
    -->
    <theoplayer-default-ui
      configuration='{"libraryLocation":"https://cdn.theoplayer.com/dash/theoplayer/","licenseUrl":"../../../../theoplayer-license.txt","mutedAutoplay":"all"}'
      source='{"sources":{"type":"millicast","src":"multiview","streamAccountId":"k9Mwad"}}'
    ></theoplayer-default-ui>
    <script src="../utils.js"></script>
  </body>
</html>
```
