Skip to content Skip to sidebar Skip to footer

Parameter Passed Without Explicitly Stating Javascript Chrome Extension

So this example chrome extension calls a selector for media streams and then the gotStream(stream) clearly is looking for a parameter of a mediaObject. However, when the gotStream

Solution 1:

Is there an error of some sorts, or you just don't understand how that works?

navigator.webkitGetUserMediaexpects 3 arguments. One for configuration data, one for a function to call on success (a success callback) and one to call on error.

Note that it expects a function. This code passes a reference to the function by name; it will be called with the appropriate parameter (from within webkitGetUserMedia).

Consider this code, it works in the same manner:

functionhello(subject) {
  alert("Hello, " + subject + "!");
}

functionpassWorldTo(callback) {
  callback("world");  
}

passWorldTo(hello);

Post a Comment for "Parameter Passed Without Explicitly Stating Javascript Chrome Extension"