# FrameReader

URL: https://www.caprid.com/docs/reference/typescript/caprid/relay/media/interfaces/framereader/

Defined in: [relay-sdks/ts/src/frame-reader.ts:52](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L52)

A subscription's or a want's handlers that read its track as frames in decode order. Pass it, or spread it with
handlers of your own, to `subscribe` or `want`. Each group is one subgroup, as the frame writer sends it, so a
subgroup's end is its group's. A want read through a reader keeps `drainMs` at 0, the default: a drained old
subscription's groups would arrive after the Move, indistinguishable from the new one's.

## Methods

### close()

```ts
close(): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:66](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L66)

Stop delivering and cancel the pending poll. Later events are ignored.

#### Returns

`void`

***

### onObject()

```ts
onObject(object): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:56](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L56)

Feeds the object to the sequencer and delivers what is ready.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `object` | [`MoqtObject`](https://www.caprid.com/docs/reference/typescript/caprid/relay/index/interfaces/moqtobject/) |

#### Returns

`void`

***

### onRestarted()

```ts
onRestarted(): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:62](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L62)

A want's Restart: the sequencer starts over and marks the next frame.

#### Returns

`void`

***

### onSubgroupEnd()

```ts
onSubgroupEnd(info): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:58](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L58)

Ends the object's group.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `info` | \{ `groupId`: `number`; \} |
| `info.groupId` | `number` |

#### Returns

`void`

***

### onSubgroupReset()

```ts
onSubgroupReset(info): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:60](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L60)

Resets the object's group: its remaining objects will not come.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `info` | \{ `groupId`: `number`; \} |
| `info.groupId` | `number` |

#### Returns

`void`

***

### onSubscribed()

```ts
onSubscribed(info): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:54](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L54)

Takes the track properties, which may declare the Timescale.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `info` | [`SubscribeOk`](https://www.caprid.com/docs/reference/typescript/caprid/relay/index/interfaces/subscribeok/) |

#### Returns

`void`

***

### onSwitched()

```ts
onSwitched(info): void;
```

Defined in: [relay-sdks/ts/src/frame-reader.ts:64](https://github.com/caprids/relay-sdks/blob/main/ts/src/frame-reader.ts#L64)

A want's Move: the same, with the new subscription's track properties.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `info` | [`WantSwitchedInfo`](https://www.caprid.com/docs/reference/typescript/caprid/relay/index/interfaces/wantswitchedinfo/) |

#### Returns

`void`
