-
Notifications
You must be signed in to change notification settings - Fork 6
gwp sample application
Andre Lafleur edited this page May 10, 2026
·
6 revisions
This comprehensive sample application demonstrates the features of the Genetec Web Player (GWP). The sample serves three purposes:
- Demonstration: shows GWP capabilities in action.
- Testing tool: verify camera functionality and features.
- Debugging tool: troubleshoot issues with detailed logging and status displays.
View HTML source code. Copy the code or use your browser's "Save As" to download and run locally.
The sample application includes:
- Player lifecycle management with proper initialization and cleanup.
- Playback controls: live playback, pause and resume, seeking (±10s, ±1m, specific time), and variable playback speed (-100x to +100x).
- PTZ controls: 9-directional pad for pan and tilt, zoom controls, preset positions, home position, lock and unlock, and low-latency mode.
- Digital zoom: client-side zoom from 1x to 20x with preview and snapshot capabilities.
- Fisheye dewarping with preview controls, when the camera is configured with a fisheye lens.
- Interactive timeline: HTML5 canvas showing recording sequences (green bars), bookmarks (blue lines), current time (red line), and playback position (purple line with triangle). Click anywhere on the timeline to seek to that time. The timeline range adjusts from 0.5 to 72 hours in 30-minute increments.
- Advanced features: audio toggle, privacy protection, snapshot capture, debug overlay, stream-usage selection, and verbose logging.
- Real-time status monitoring with 10+ indicators showing connection state, player state, stream status, and more.
- Event logging: color-coded event log with timestamps for debugging.
The application uses a three-panel layout:
┌─────────────┬──────────────────┬─────────────┐
│ Controls │ Video player │ Status │
│ (left) │ and timeline │ and logs │
│ │ (center) │ (right) │
└─────────────┴──────────────────┴─────────────┘
- Left panel (350px): connection settings and control interfaces.
- Center panel (flexible width): video player, timeline visualization, and advanced features.
- Right panel (300px): real-time status displays and event log.
The layout is responsive and adapts to mobile devices.
Use these patterns to structure the sample application and the event-handling flow.
Register all event handlers before calling player.start():
// Register handlers first
player.onErrorStateRaised.register((error) => { /* ... */ });
player.onFrameRendered.register((time) => { /* ... */ });
// ... other handlers
// Then start the player
await player.start(cameraId, mediaGatewayUrl, getToken);The player requires a token function that returns a valid authentication token:
async function getToken(cameraId) {
const credentials = `${username};${appId}:${password}`;
const response = await fetch(
`https://${mediaGateway}/media/v2/token/${cameraId}`,
{
credentials: 'include',
headers: { 'Authorization': `Basic ${btoa(credentials)}` }
}
);
return await response.text();
}Stop and dispose of the player when the application no longer needs it:
player.stop();
player.dispose();
player = null;- Genetec Web Player developer guide: Embedding the Genetec Web Player in browser-based applications.
- GWP API reference: Genetec Web Player API reference (TypeScript definitions and methods).
- GWP multiplexing sample: Multi-camera GWP grid sharing one WebSocket connection.
- Media Gateway developer guide: RTSP and HTTP video streaming through the Media Gateway role.
- Overview
- Connecting to Security Center
- SDK certificates
- Referencing SDK assemblies
- SDK compatibility
- Entities
- Entity cache
- Transactions
- Events
- Actions
- Security Desk
- Custom events
- ReportManager
- ReportManager query reference
- DownloadAllRelatedData and StrictResults
- Privileges
- Partitions
- About custom fields
- About video
- About cameras
- Enrolling a video unit
- Archiver and auxiliary archiver roles
- Archive transfer
- About access control
- About cardholders and credentials
- About doors, areas, elevators, and access points
- About access rules and schedules
- About access control units and interface modules
- Enrolling an access control unit
- Door templates
- Visitors
- Mobile credentials
- About threat levels
- About alarms
- Maps
- Logging
- Overview
- Certificates
- Lifecycle
- Threading
- State management
- Configuration
- Restricted configuration
- Events
- Queries
- Request manager
- Database
- Entity ownership
- Entity mappings
- Server management
- Custom privileges
- Custom entity types
- Resolving non-SDK assemblies
- Deploying plugins
- .NET 8 support
- Overview
- Certificates
- Creating modules
- Tasks
- Pages
- Components
- Tile extensions
- Services
- Contextual actions
- Options extensions
- Configuration pages
- Monitors
- Shared components
- Commands
- Extending events
- Map extensions
- Timeline providers
- Image extractors
- Credential encoders
- Credential readers
- Cardholder fields extractors
- Badge printers
- Content builders
- Dashboard widgets
- Incidents
- Logon providers
- Pinnable content builders
- Custom report pages
- Overview
- Getting started
- MediaPlayer
- VideoSourceFilter
- MediaExporter
- MediaFile
- G64 converters
- FileCryptingManager
- PlaybackSequenceQuerier
- PlaybackStreamReader
- OverlayFactory
- PtzCoordinatesManager
- AudioTransmitter
- AudioRecorder
- AnalogMonitorController
- Camera blocking
- Overview
- Getting started
- Referencing entities
- Entity operations
- About access control in the Web SDK
- About video in the Web SDK
- Users and user groups
- Partitions
- Custom fields
- Custom card formats
- Actions
- Events and alarms
- Incidents
- Reports
- Tasks
- Macros
- Custom entity types
- System endpoints
- Performance guide
- Reference
- Under the hood
- Troubleshooting