PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Other / Miscellaneous/Verkada

Implement a JavaScript frame player controller

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of precise time-based scheduling, browser timer APIs, closure-based state encapsulation, and playback control logic in JavaScript for a frame-by-frame media controller.

  • medium
  • Verkada
  • Other / Miscellaneous
  • Software Engineer

Implement a JavaScript frame player controller

Company: Verkada

Role: Software Engineer

Category: Other / Miscellaneous

Difficulty: medium

Interview Round: Technical Screen

You are given a skeleton for a frame-by-frame browser media player. Implement a JavaScript controller that: - Jumps to any frame by index. - Starts and pauses autoplay at a configurable frames-per-second (FPS). - Exposes methods: play(), pause(), seek(frameIndex), setFPS(fps), currentFrame(), isPlaying(). - Uses setTimeout or setInterval correctly to schedule frames, handles timer drift, and prevents overlapping timers. - Encapsulates internal state via closures and cleans up timers/listeners to avoid memory leaks. Explain your design and time-scheduling strategy, compare setTimeout vs setInterval (and optionally requestAnimationFrame) for this use case, and describe how you would handle edge cases (seeking while playing, invalid indices, reaching the last frame, resuming after pause). Provide pseudocode or tests showing expected behavior.

Quick Answer: This question evaluates a candidate's understanding of precise time-based scheduling, browser timer APIs, closure-based state encapsulation, and playback control logic in JavaScript for a frame-by-frame media controller.

Verkada logo
Verkada
Jul 15, 2025, 12:00 AM
Software Engineer
Technical Screen
Other / Miscellaneous
3
0

Implement a frame-by-frame browser media controller with drift-proof scheduling

Context

You are given a skeleton for a frame-by-frame browser media player. Assume you have:

  • A renderFrame(index) callback that draws frame index onto the UI (e.g., a canvas or an image element).
  • A known total number of frames: frameCount.

Your job is to implement a JavaScript controller that manages playback precisely by frames.

Requirements

Implement a controller that:

  1. Jumps to any frame by index.
  2. Starts and pauses autoplay at a configurable frames-per-second (FPS).
  3. Exposes methods:
    • play()
    • pause()
    • seek(frameIndex)
    • setFPS(fps)
    • currentFrame()
    • isPlaying()
  4. Uses setTimeout or setInterval correctly to schedule frames, handles timer drift, and prevents overlapping timers.
  5. Encapsulates internal state via closures and cleans up timers/listeners to avoid memory leaks.

Deliverables

  • A working design and explanation of your time-scheduling strategy.
  • A comparison of setTimeout vs setInterval (and optionally requestAnimationFrame) for this use case.
  • Pseudocode or tests showing expected behavior and edge cases.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Other / Miscellaneous•More Verkada•More Software Engineer•Verkada Software Engineer•Verkada Other / Miscellaneous•Software Engineer Other / Miscellaneous
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.