Skip to content

gwp sample application

Andre Lafleur edited this page Feb 3, 2026 · 3 revisions

Genetec Web Player - Sample Application

This comprehensive sample application demonstrates all features of the Genetec Web Player (GWP). The sample serves three purposes:

  1. Demonstration - Shows all GWP capabilities in action
  2. Testing Tool - Verify camera functionality and features
  3. Debugging Tool - Troubleshoot issues with detailed logging and status displays

Download Sample Application

View HTML source code - Copy the code or use your browser's "Save As" to download and run locally.

Features

The sample application includes:

  • Player Lifecycle Management - Start and stop the player with proper initialization and cleanup
  • Playback Controls - Live playback, pause/resume, seeking (±10s, ±1m, specific time), and variable playback speed (-100x to +100x)
  • PTZ Controls - 9-directional pad for pan/tilt, zoom controls, preset positions, home position, lock/unlock, and low-latency mode
  • Digital Zoom - Client-side zoom from 1x to 20x with preview and snapshot capabilities
  • Dewarping - Fisheye lens dewarping with preview controls (when camera is configured with fisheye)
  • 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. Timeline range adjustable 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 - 10+ status indicators showing connection state, player state, stream status, and more
  • Event Logging - Color-coded event log with timestamps for debugging

User Interface

The application uses a three-panel layout:

┌─────────────┬──────────────────┬─────────────┐
│   Controls  │   Video Player   │   Status    │
│   (Left)    │   & Timeline     │   & Logs    │
│             │   (Center)       │   (Right)   │
└─────────────┴──────────────────┴─────────────┘
  • Left Panel (350px) - Connection settings and all control interfaces
  • Center Panel (Flexible) - 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.

Key Implementation Patterns

Event Handler Registration

All event handlers must be registered 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);

Token Retrieval Function

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();
}

Proper Cleanup

Always stop and dispose of the player when done:

player.stop();
player.dispose();
player = null;

See also

Security Center SDK

  • Security Center SDK Developer Guide Overview of the SDK framework and how to build integrations with Security Center.

    • Platform SDK

      • Overview Introduction to the Platform SDK and core concepts.
      • Connecting to Security Center Step-by-step guide for connecting and authenticating with the SDK.
      • SDK Certificates Details certificates, licensing, and connection validation.
      • Referencing SDK Assemblies Best practices for referencing assemblies and resolving them at runtime.
      • SDK Compatibility Guide Understanding backward compatibility and versioning in the SDK.
      • Entity Guide Explains the core entity model, inheritance, and how to work with entities.
      • Entity Cache Guide Describes the engine's local entity cache and synchronization.
      • Transactions Covers batching operations for performance and consistency.
      • Events Subscribing to real-time system events.
      • Actions Sending actions to Security Center.
      • Security Desk Displaying content on monitors, reading tiles, sending tasks, and messaging operators.
      • Custom Events Defining, raising, and subscribing to custom events.
      • ReportManager Querying entities and activity data from Security Center.
      • ReportManager Query Reference Complete reference of query types, parameters, and response formats.
      • Privileges Checking, querying, and setting user privileges.
      • Partitions Entity organization and access control through partitions.
      • Logging How to configure logging, diagnostics, and debug methods.
    • Plugin SDK

    • Workspace SDK

    • Macro SDK

      • Overview How macros work, creating and configuring macro entities, automation, and monitoring.
      • Developer Guide Developing macro code with the UserMacro class and Security Center SDK.

Web SDK Developer Guide

  • Getting Started Setup, authentication, and basic configuration for the Web SDK.
  • Referencing Entities Entity discovery, search capabilities, and parameter formats.
  • Entity Operations CRUD operations, multi-value fields, and method execution.
  • Partitions Managing partitions, entity membership, and user access control.
  • Custom Fields Creating, reading, writing, and filtering custom entity fields.
  • Custom Card Formats Managing custom credential card format definitions.
  • Actions Control operations for doors, cameras, macros, and notifications.
  • Events and Alarms Real-time event monitoring, alarm monitoring, and custom events.
  • Incidents Incident management, creation, and attachment handling.
  • Reports Activity reports, entity queries, and historical data retrieval.
  • Tasks Listing and executing saved report tasks.
  • Macros Monitoring currently running macros.
  • Custom Entity Types Listing, retrieving, and deleting custom entity type descriptors.
  • System Endpoints License usage, web tokens, and exception handling.
  • Performance Guide Optimization tips and best practices for efficient API usage.
  • Reference Entity GUIDs, EntityType enumeration, and EventType enumeration.
  • Under the Hood Technical architecture, query reflection, and SDK internals.
  • Troubleshooting Common error resolution and debugging techniques.

Media Gateway Developer Guide


Web Player Developer Guide

  • Developer Guide Complete guide to integrating GWP for live and playback video streaming.
  • API Reference Full API documentation with interfaces, methods, properties, and events.
  • Sample Application Comprehensive demo showcasing all GWP features with timeline and PTZ controls.
  • Multiplexing Sample Multi-camera grid demo using a shared WebSocket connection.

Clone this wiki locally