Video API
Overview
Release Notes
Discover & Test
Build Your Solution
Client SDKs
Migration Guides
OpenTok Server SDK Transition Guides
Guides
Overview
Create a Token
Create a Session
Joining a Session
Getting Started
Initializing a Session Object
Connecting to a session
Disconnect from a Session
Detecting when you have disconnected
Automatic reconnection
Detecting when clients have connected and disconnected
Troubleshooting session connection issues (Javascript)
Troubleshooting session connection issues (React Native)
Audio fallback
Moderation
Publishing Streams
Subscribe to Streams
Overview
Detect when streams are created in a session
Subscribe to a stream
Automatic reconnection
Detecting when streams end and a subscriber's video is disabled
Getting information about a stream
Unsubscribe from a stream (Javascript only)
Managing subscriber streams (Javascript Only)
Managing subscriber streams (React Native)
Troubleshooting (Javascript Only)
UI Customization
General customization
Swift
Web Only
Directly accessing the video element for a Publisher or Subscriber
Displaying a custom UI element when Subscriber audio is blocked
Adjusting video cropping and letterboxing
Hiding all built-in user interface controls for videos
Displaying or hiding the name in a video
Setting an image to display in audio-only mode
Setting the initial position and dimensions of a video
Accessing MediaStream objects
Accessing MediaStream objects for Subscribers
Resizing or repositioning a video
Getting a snapshot image of a video
Management & Signaling
Video Session Customization
Archiving
Broadcast
Experience Composer
SIP Interconnect
AI Connectors
Media Processor
Additional Resources
Security
Networking & Environment
Tools & Debugging
Tutorials
API Reference
Developer Tools
Vonage Video API Reference App for React
Manage & Support
Video Express
Video + AI
Accessing MediaStream objects for Subscribers
You can access the MediaStream object used by a Subscriber. The HTMLVideoElement object (in the videoElementCreated event dispatched by the Subscriber, described in the previous section), has a srcObject property. This is the MediaStream object for the Subscriber's audio-video stream. You can use that MediaStream object as the source MediaStream for another Video element (as its srcObject property):
In a routed session that uses Adaptive Media Routing, the MediaStream for a subscriber can change when the session switches from relayed to routed streams (see this Help Center knowledge base article). Add an event listener for the play event for a Subscriber object's Video element to get the updated MediaStream instance:
Navigation
Accessing MediaStream objects for Subscribers