Skip to content

Commit bb6273f

Browse files
authored
Add custom media session attribute docs to README.md (#630)
* Adds docs for custom media session attributes to Web Media SDK readme
1 parent 4ea7622 commit bb6273f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const mediaSession = new MediaSession(
5858
'OnDemand' // Stream Type (OnDemand, Live, etc.)
5959
true, // Log Page Event Toggle (true/false)
6060
true, // Log Media Event Toggle (true/false)
61+
{
62+
"my_session_attribute": "My Session Attribute"
63+
} // (optional) Custom Session Attributes object used for each media event within the Media Session
6164
)
6265
6366
mediaSession.logMediaSessionStart();
@@ -81,6 +84,24 @@ const customAttributes = {
8184
mediaSession.logPlay({ options: currentAttributes });
8285
```
8386

87+
### Custom media session attributes
88+
89+
You can create custom media session attributes when initializing a new media session by including the custom media session attributes object directly in the MediaSession() builder:
90+
91+
```javascript
92+
{
93+
"my_session_attribute": "My Session Attribute" // Example key/value pair for a custom media session attribute
94+
}
95+
```
96+
97+
Custom media session attributes are automatically propagated to all media events logged during the session in addition to the media session summary event. Since custom session attributes are propagated to any event (a media event, advertising event, or a custom events) that is logged during the session, you don’t need to set these attributes again when you trigger the start of a media session.
98+
99+
#### Custom media session attribute limits
100+
101+
* 100 key/value pairs per media session
102+
* Keys must be strings and cannot exceed 255 characters
103+
* Values may be strings, numbers, booleans, or dates, and cannot exceed 4096 characters
104+
84105
### Logging Playhead Position
85106

86107
Most of our partner integrations require that a media player frequently trigger a _timeline update_ or _heartbeat_ event. Our API provides two different methods of updating the playhead position based on your needs.

0 commit comments

Comments
 (0)