Skip to content

video.get() seems to freeze live stream of the video #3153

@CreativeCode

Description

@CreativeCode

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Most appropriate sub-area of p5.js?

  • Color
  • Core/Environment/Rendering
  • Data
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Other (DOM?)

Which platform were you using when you encountered this?

  • Mobile/Tablet (touch devices)
  • Desktop/Laptop
  • Others (specify if possible)

Details about the bug:

  • p5.js version: 0.6.1
  • Web browser and version: Version 68.0.3440.106 (Official Build) (64-bit)
  • Operating System: Mac
  • Steps to reproduce this:

Run the following code and you will see that the video no longer is updated after video.get() is called.:

function takesnap() {
   currentImg = video.get(); 
}

function setup() {
    createCanvas(600, 240);
    video = createCapture(VIDEO);
    video.size(320, 240);
    video.hide();
    background(0);
    captureBtn = createButton('snap');
    captureBtn.mousePressed(takesnap);
}

function draw() {
    image(video,0,0);
}

Workaround by @meiamsome 👍

function draw() {
  var frame = video.get();
  image(frame, 0, 0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions