@@ -301,7 +301,7 @@ module.exports = function(Cam) {
301301 }
302302 } else if ( typeof options == "string" ) { // For backward compatibility
303303 options = { configurationToken : options } ;
304- } else if ( ! ( options && ( options . configurationToken || options . profileToken ) ) ) {
304+ } else if ( ! ( options && ( options . configurationToken !== undefined || options . profileToken !== undefined ) ) ) {
305305 return callback ( new Error ( "'options' must have one or both 'configurationToken' or 'profileToken'" ) ) ;
306306 }
307307 const service = this . media2Support ? 'media2' : 'media' ;
@@ -394,7 +394,7 @@ module.exports = function(Cam) {
394394 * @param {Cam~VideoEncoderConfigurationCallback } callback
395395 */
396396 Cam . prototype . setVideoEncoderConfiguration = function ( options , callback ) {
397- if ( ! options . token && ! ( options . $ && options . $ . token ) ) {
397+ if ( options . token === undefined && ! ( options . $ && options . $ . token !== undefined ) ) {
398398 return callback ( new Error ( 'No video encoder configuration token is present!' ) ) ;
399399 }
400400 const service = this . media2Support ? 'media2' : 'media' ;
@@ -418,9 +418,9 @@ module.exports = function(Cam) {
418418 ( options . quality ? '<Quality xmlns="http://www.onvif.org/ver10/schema">' + options . quality + '</Quality>' : '' ) +
419419 ( options . rateControl ?
420420 `<RateControl ConstantBitRate="${ ConstantBitRate } " xmlns="http://www.onvif.org/ver10/schema"> ` +
421- ( options . rateControl . frameRateLimit ? '<FrameRateLimit>' + options . rateControl . frameRateLimit + '</FrameRateLimit>' : '' ) +
422- ( options . rateControl . encodingInterval ? '<EncodingInterval>' + options . rateControl . encodingInterval + '</EncodingInterval>' : '' ) +
423- ( options . rateControl . bitrateLimit ? '<BitrateLimit>' + options . rateControl . bitrateLimit + '</BitrateLimit>' : '' ) +
421+ ( options . rateControl . frameRateLimit !== undefined ? '<FrameRateLimit>' + options . rateControl . frameRateLimit + '</FrameRateLimit>' : '' ) +
422+ ( options . rateControl . encodingInterval !== undefined ? '<EncodingInterval>' + options . rateControl . encodingInterval + '</EncodingInterval>' : '' ) +
423+ ( options . rateControl . bitrateLimit !== undefined ? '<BitrateLimit>' + options . rateControl . bitrateLimit + '</BitrateLimit>' : '' ) +
424424 '</RateControl>' : '' ) +
425425 ( options . MPEG4 ?
426426 '<MPEG4 xmlns="http://www.onvif.org/ver10/schema">' +
@@ -589,7 +589,7 @@ module.exports = function(Cam) {
589589 * @param {Cam~AudioEncoderConfigurationCallback } callback
590590 */
591591 Cam . prototype . setAudioEncoderConfiguration = function ( options , callback ) {
592- if ( ! options . token && ! ( options . $ && options . $ . token ) ) {
592+ if ( options . token === undefined && ! ( options . $ && options . $ . token !== undefined ) ) {
593593 return callback ( new Error ( 'No audio encoder configuration token is present!' ) ) ;
594594 }
595595 this . _request ( {
0 commit comments