diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..fa29cdf
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1 @@
+**
\ No newline at end of file
diff --git a/lib/media.js b/lib/media.js
index 8835587..d836146 100644
--- a/lib/media.js
+++ b/lib/media.js
@@ -1255,8 +1255,26 @@ module.exports = function(Cam) {
* @param {string} [options.dateFormat] Date to overlay. Must be used with timeFormat, otherwise plaintext will be used.
* @param {string} [options.timeFormat] Time to overlay. Must be used with dateFormat, otherwise plaintext will be used.
* @param {number} [options.fontSize] The text font size.
+ * @param {string} [options.colorspace] Colorspace - RGB or YCbCr. Default RGB.
* @param {object} [options.fontColor] The color of the text font (OSDColor), should be object with properties - X, Y, Z.
+ * @param {float} [options.fontColor.X] For RGB - means R value, For YCbCr means Y value.
+ * @param {float} [options.fontColor.Y] For RGB - means G value, For YCbCr means Cb value.
+ * @param {float} [options.fontColor.Z] For RGB - means B value, For YCbCr means Cr value.
* @param {Cam~GetOSDOptionsCallback} callback
+ * @example
+ * await cam.createOSD({
+ * position: "LowerLeft",
+ * timeFormat: "HH:mm:ss",
+ * dateFormat: "YYYY-MM-DD",
+ * fontSize: 1,
+ * colorspace: "RGB",
+ * fontColor: {
+ * X: 1,
+ * Y: 0.7,
+ * Z: 0.9,
+ * }
+ * });
+ *
*/
Cam.prototype.createOSD = function(options, callback) {
if (callback === undefined) { callback = options; options = {}; }
@@ -1282,10 +1300,11 @@ module.exports = function(Cam) {
${options.plaintext}`}
${options.fontSize ? `${options.fontSize}` : ""}
- ${options.fontColor ? `
-
- ${''}
- ` : ""}
+ ${ options.fontColor && options.fontColor.X && options.fontColor.Y && options.fontColor.Z ?
+ `
+
+ ${ '' }
+ ` : "" }
` +
@@ -1311,8 +1330,13 @@ module.exports = function(Cam) {
* @param {string} [options.dateFormat] Date to overlay. Must be used with timeFormat, otherwise plaintext will be used.
* @param {string} [options.timeFormat] Time to overlay. Must be used with dateFormat, otherwise plaintext will be used.
* @param {number} [options.fontSize] The text font size.
+ * @param {string} [options.colorspace] Colorspace - RGB or YCbCr. Default RGB.
* @param {object} [options.fontColor] The color of the text font (OSDColor), should be object with properties - X, Y, Z.
+ * @param {float} [options.fontColor.X] For RGB - means R value, For YCbCr means Y value.
+ * @param {float} [options.fontColor.Y] For RGB - means G value, For YCbCr means Cb value.
+ * @param {float} [options.fontColor.Z] For RGB - means B value, For YCbCr means Cr value.
* @param {Cam~GetOSDOptionsCallback} callback
+ * @see {Cam~createOSD}
*/
Cam.prototype.setOSD = function(options, callback) {
let mediaType = (this.media2Support ? 'media2' : 'media');
@@ -1342,14 +1366,11 @@ module.exports = function(Cam) {
options.fontSize ?
`${options.fontSize}` : ''
}
- ${
- options.fontColor ?
+${ options.fontColor && options.fontColor.X && options.fontColor.Y && options.fontColor.Z ?
`
-
- ${''}
-
- ` : ''
-}
+
+ ${ '' }
+ ` : "" }
` +