---
title: roRtspStream
slug: develop/rortspstream
docTags: 
createdAt: 2025-03-26T17:24:33.704Z
---

This is a simple media-streaming object that is passed to the *roVideoPlayer.PlayFile()&#x20;*&#x6D;ethod. Use this object to play UDP, RTP, HLS, and HTTP streams. See the [Video Streaming](docId\:o9GIleB8eiEJpZhqRe7Q5) and [Stream Content via IP Camera](docId:0er0hhTcryaPJTXszy_55) FAQs for more details. The JavaScript equivalent is to use \<video> elements.

Object Creation: To play a stream, instantiate an *roRtspStream* object with a URL as its argument. Then pass it to the PlayFile() method as shown in the following example:

```none
v = createobject("rovideoplayer")
r = createobject("rortspstream", "http://172.30.1.37/alldigital/1080p/playlist.m3u8")
v.playfile({rtsp:r}) 
```

:::hint{type="info"}
The key in the passed associative array will always be "rtsp", no matter which streaming protocol is used.
:::

## ifRtspStream

**GetUrl() As String**

Retrieves the currently configured URL.

**AddHeader(header As String, text As String)**

Adds the specified header and header text to the streaming request. The ":" after the header and the "\r\n" after the header text are supplied automatically by the method. Headers only take effect when a stream is played; you cannot add more headers when a stream is playing (though these headers will be applied if the stream is played again).

**ClearHeaders()**

Removes headers that have been added using the `AddHeader()` method.

## ifMessagePort

**SetPort(port As roMessagePort)**

Posts event messages to the attached message port. The event messages are of the type roRtspStreamEvent and will implement the ifInt interface.

## ifUserData

**SetUserData(user\_data As Object)**

Sets the user data that will be returned when events are raised.

**GetUserData() As Object**

Returns the user data that has previously been set via `SetUserData()`. It will return Invalid if no data has been set.
