GStreamer's `CLOCK_TIME_NONE` is too large for JavaScript.
I'm making a Gstreamer app, and whenever I need to do stuff like:
const state = this.playbin.get_state(Gst.CLOCK_TIME_NONE)[1];
if (state === Gst.State.PLAYING) {
this.pause();
} else {
this.play();
}
//...
it fails, because Gst.CLOCK_TIME_NONE
is higher than the max number in JavaScript. I get the following error:
(com.vixalien.muzika:470893): Gjs-WARNING **: 13:15:26.081: Value 18446744073709551615 cannot be safely stored in a JS Number and may be rounded
(com.vixalien.muzika:470893): Gjs-CRITICAL **: 13:15:26.081: JS ERROR: Error: Argument timeout: value is out of range for uint64
play_pause@resource:///com/vixalien/muzika/js/main.js:14487:32
When I use Number.MAX_SAFE_INTEGER
instead of Gst.CLOCK_TIME_NONE
, it works.
I think it might be a good solution to override Gst.CLOCK_TIME_NONE
to Number.MAX_SAFE_INTEGER
if that's possible.
Note that using Number.MAX_VALUE
doesn't work either, and this throws: JS ERROR: Error: Argument timeout: value is out of range for uint64