      1 /*
      2  * This is system cordova_plugin (TV specific API).
      3  * Apache License (2004). See http://www.apache.org/licenses/LICENSE-2.0
      4  *
      5  * Copyright (c) 2014, LG Electronics, Inc.
      6  */
      7
      8
      9 /**
     10  * This represents the video API itself, and provides a global namespace for operating video service.
     11  * @class
     12  */
     13 cordova.define('cordova/plugin/video', function (require, exports, module) { // jshint ignore:line
     14
     15     function log(msg) {
     16     //    //console.log//will be removed // jshint ignore:line
     17     }
     18
     19     var service;
     20     if (window.PalmSystem) { // jshint ignore:line
     21         log("Window.PalmSystem Available");
     22         service = require('cordova/plugin/webos/service');
     23     } else {
     24         service = {
     25             Request : function(uri, params) {
     26                log(uri + " invoked. But I am a dummy because PalmSystem is not available");
     27
     28                if (typeof params.onFailure === 'function') {
     29                   params.onFailure({
     30                       returnValue:false,
     31                       errorText:"PalmSystem Not Available. Cordova is not installed?"
     32                     });
     33                }
     34         }};
     35     }
     36
     37     /**
     38      * video interface
     39      */
     40     var Video = function () {
     41     };
     42
     43
     44     function checkErrorCodeNText(result, errorCode, errorText) {
     45
     46         if (result.errorCode === undefined || result.errorCode === null ) {
     47             result.errorCode = errorCode;
     48         }
     49         if (result.errorText ===undefined || result.errorText === null) {
     50             result.errorText = errorText;
     51         }
     52     }
     53
     54     var platformInfoObj = {
     55         webOSVer : -1,
     56         chipset : 'undefined'
     57     };
     58     function checkPlatformVersion(cb) {
     59
     60         if (platformInfoObj.webOSVer === -1) {  // Not defined yet
     61
     62             service.Request('luna://com.webos.service.tv.systemproperty', {
     63                 method: 'getSystemInfo',
     64                 parameters: {
     65                     keys: ["sdkVersion", "boardType"]
     66                 },
     67                 onSuccess: function(result) {
     68                     var temp = result.sdkVersion.split('.');
     69                     if (temp.length >= 1 && temp[0] === '1') {
     70                         platformInfoObj = {
     71                             webOSVer : 1,
     72                             chipset : result.boardType.split("_")[0]
     73                         };
     74                     } else if (temp.length >= 1 && temp[0] === '2') {
     75                         platformInfoObj = {
     76                             webOSVer : 2,
     77                             chipset : result.boardType.split("_")[0]
     78                         };
     79                     } else if (temp.length >= 1 && temp[0] === '3') {
     80                         platformInfoObj = {
     81                             webOSVer : 3,
     82                             chipset : result.boardType.split("_")[0]
     83                         };
     84                     } else {
     85                         platformInfoObj = {
     86                             webOSVer : 0,
     87                             chipset : ""
     88                         };
     89                     }
     90                     cb(platformInfoObj);
     91                 },
     92                 onFailure: function(error) {
     93                     platformInfoObj = {
     94                         webOSVer : 0,
     95                         chipset : ""
     96                     }
     97                     cb(platformInfoObj);
     98                 }
     99             });
    100
    101         } else {
    102             cb(platformInfoObj);
    103         }
    104     }
    105
    106     /**
    107      * Gets video position and size.
    108      * @class Video
    109      * @param {Function} successCallback success callback function.
    110      * @param {Function} errorCallback failure callback function.
    111      * @return {Object}
    112      * <div align=left>
    113      * <table class="hcap_spec" width=400>
    114      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th></tr></thead>
    115      *   <tbody>
    116      *       <tr><th>source</th><th>Object</th><th>source rectangle of video. </th></tr>
    117      *       <tr><th>source.x</th><th>Number</th><th>The x coordinate of the upper-left corner of the rectangle. </th></tr>
    118      *       <tr class="odd"><th>source.y</th><th>Number</th><th>The y coordinate of the upper-left corner of the rectangle. </th></tr>
    119      *       <tr><th>source.width</th><th>Number</th><th>The width of the rectangle. </th></tr>
    120      *       <tr class="odd"><th>source.height</th><th>Number</th><th>The height of the rectangle. </th></tr>
    121      *   </tbody>
    122      * </table>
    123      *
    124      * @example
    125      * // Javascript code
    126      * function getVideoStatus () {
    127      *   function successCb(cbObject) {
    128      *      console.log("cbObject : " + JSON.stringify(cbObject.source));
    129      *
    130      *      console.log("source.x : " + cbObject.source.x);
    131      *      console.log("source.y : " + cbObject.source.y);
    132      *      console.log("source.width : " + cbObject.source.width);
    133      *      console.log("source.height : " + cbObject.source.height);
    134      *
    135      *      // Do something
    136      *         ...
    137      *   }
    138      *
    139      *   function failureCb(cbObject) {
    140      *      var errorCode = cbObject.errorCode;
    141      *      var errorText = cbObject.errorText;
    142      *      console.log ("Error Code [" + errorCode + "]: " + errorText);
    143      *   }
    144      *
    145      *   var video = new Video();
    146      *   video.getVideoStatus(successCb, failureCb);
    147      * }
    148      * @since 1.0
    149      * @see
    150      * <a href="Video%23setVideoSize.html">Video.setVideoSize()</a><br>
    151      */
    152     Video.prototype.getVideoStatus = function (successCallback, errorCallback) {
    153
    154         log("getVideoStatus: ");
    155
    156         service.Request("luna://com.webos.service.tv.signage/", {
    157             method : "getVideoSize",
    158             onSuccess : function(result) {
    159                 log("getVideoStatus: On Success");
    160
    161                 if (result.returnValue === true) {
    162                     if (typeof successCallback === 'function') {
    163                         var cbObj = {};
    164                         cbObj.source = result.videoSize.source;
    165                         successCallback(cbObj);
    166                     }
    167                 }
    168             },
    169             onFailure : function(result) {
    170                 log("getVideoStatus: On Failure");
    171                 delete result.returnValue;
    172                 if (typeof errorCallback === 'function') {
    173                     checkErrorCodeNText(result, "VGVS", "Video.getVideoStatus returns failure.");
    174                     errorCallback(result);
    175                 }
    176             }
    177         });
    178
    179         log("Video.getVideoStatus Done");
    180
    181     };
    182
    183     Video.currentVideo = {
    184         uri : null,
    185         source : null,
    186         tagId : null
    187     };
    188
    189     /**
    190      * Sets video size.<br>
    191      * Original video(source rectangle) will be adjusted to the full screen size. It can be resized or a zoom effect can be applied to the video.
    192      * <br>
    193      * Note : Using more than one video tag in an html page may not be supported due to hardware limitation.
    194      *
    195      * @class Video
    196      * @param {Function} successCallback success callback function.
    197      * @param {Function} errorCallback failure callback function.
    198      * @param {Object} options source object vary depending on video resolution.
    199      *                  And rectangle object has boundary value as : <br>
    200      *                  source.x + source.width <= width of video resolution , source.y + source.height <= height of video resolution <br>
    201      *                  x and y value of rectangle are upper than zero.
    202      * <br><image src="./image/setVideoSize.png"><br>
    203      * <div align=left>
    204      * <table class="hcap_spec" width=400>
    205      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead>
    206      *   <tbody>
    207      *       <tr><th>source</th><th>Object</th><th>source rectangle of video. </th><th>required</th></tr>
    208      *       <tr><th>source.x</th><th>Number</th><th>The x coordinate of the upper-left corner of the rectangle. </th><th>required</th></tr>
    209      *       <tr class="odd"><th>source.y</th><th>Number</th><th>The y coordinate of the upper-left corner of the rectangle. </th><th>required</th></tr>
    210      *       <tr><th>source.width</th><th>Number</th><th>The width of the rectangle. </th><th>required</th></tr>
    211      *       <tr class="odd"><th>source.height</th><th>Number</th><th>The height of the rectangle. </th><th>required</th></tr>
    212      *   </tbody>
    213      * </table>
    214      *
    215      * @return <p>If the method is successfully executed, success callback function is called without a parameter.</br>
    216      * If an error occurs, failure callback function is called with a failure callback object as a parameter.</p>
    217      * @example
    218      * // Javascript code
    219      * function setVideoSize () {
    220      *   var options = {source: {x:0, y:0, width:100, height:100}};
    221      *
    222      *   function successCb() {
    223      *      // Do something
    224      *   }
    225      *
    226      *   function failureCb(cbObject) {
    227      *      var errorCode = cbObject.errorCode;
    228      *      var errorText = cbObject.errorText;
    229      *      console.log ("Error Code [" + errorCode + "]: " + errorText);
    230      *   }
    231      *
    232      *   var video = new Video();
    233      *   video.setVideoSize(successCb, failureCb, options);
    234      * }
    235      * @since 1.0
    236      * @see
    237      * <a href="Video%23getVideoStatus.html">Video.getVideoStatus()</a><br>
    238      * <a href="InputSource%23initialize.html#constructor">InputSource.initialize()</a><br>
    239      */
    240     Video.prototype.setVideoSize = function (successCallback, errorCallback, options) {
    241
    242         log("setVideoSize: " + JSON.stringify(options));
    243
    244         if (options.source === undefined ||
    245             typeof options.source.x !== 'number' || typeof options.source.y !== 'number' ||
    246             typeof options.source.width !== 'number' || typeof options.source.height !== 'number' ||
    247             isNaN(options.source.x) || isNaN(options.source.y) || isNaN(options.source.width) || isNaN(options.source.height) ||
    248             options.source.x < 0 || options.source.y < 0 || options.source.width <= 0 || options.source.height <= 0 ||
    249             options.source.width < 16 || options.source.height < 16) {
    250
    251             if (typeof errorCallback === 'function') {
    252                 var result = {};
    253                 checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure. out of range or type error.");
    254                 errorCallback(result);
    255             }
    256
    257             return;
    258         }
    259
    260         service.Request("luna://com.webos.service.tv.signage/", {
    261             method : "getVideoSize",
    262             onSuccess : function(result) {
    263                 log("setVideoSize: On Success");
    264
    265                 if (result.returnValue === true) {
    266
    267                     var cbObj = {};
    268                     cbObj.x = result.videoSize.destination.x;
    269                     cbObj.y = result.videoSize.destination.y;
    270                     cbObj.width = result.videoSize.destination.width;
    271                     cbObj.height = result.videoSize.destination.height;
    272
    273                     //console.log("current video size : " + JSON.stringify(result.videoSize.source));
    274                     //console.log("saved video : " + JSON.stringify(Video.currentVideo));
    275
    276                     var videoTags = document.getElementsByTagName("video"); // jshint ignore:line
    277                     var findVideoTags = false;
    278                     for (var i=0; i<videoTags.length; i++) {
    279                         //console.log("video tag: " + videoTags[i]);
    280                         //console.log("video tag:id " + videoTags[i].id);
    281                         // video tag
    282                         if (videoTags[i].currentTime > 0) {
    283                             //console.log("video tag is working");
    284                             findVideoTags = true;
    285                             if (Video.currentVideo.uri !== videoTags[i].src ||
    286                                 (videoTags[i].id !== null &&
    287                                  videoTags[i].id !== undefined &&
    288                                  Video.currentVideo.tagId !== null &&
    289                                  Video.currentVideo.tagId !== undefined &&
    290                                  Video.currentVideo.tagId !== videoTags[i].id) ) {
    291                                 Video.currentVideo.uri = videoTags[i].src;
    292                                 Video.currentVideo.source = result.videoSize.source;
    293                                 Video.currentVideo.tagId = videoTags[i].id;
    294                                 //console.log("saved new video : " + JSON.stringify(Video.currentVideo));
    295                             }
    296                             break;
    297                         }
    298                     }
    299                     if(findVideoTags === false) {
    300                         // external input
    301                         service.Request("luna://com.webos.service.eim/", {
    302                             method : "getCurrentInput",
    303                             parameters : {},
    304                             onSuccess : function(resultw) {
    305                                 //console.log("current input " + JSON.stringify(resultw));
    306
    307                                 if (resultw.returnValue === true && Video.currentVideo.uri !== resultw.mainInputSourceId ||
    308                                     (videoTags[0].id !== null &&
    309                                      videoTags[0].id !== undefined
    310                                      && Video.currentVideo.tagId !== null
    311                                      && Video.currentVideo.tagId !== undefined
    312                                      && Video.currentVideo.tagId !== videoTags[0].id) ) {
    313                                     Video.currentVideo.uri = resultw.mainInputSourceId;
    314                                     Video.currentVideo.tagId = (videoTags[0] !== null && videoTags[0].id !== null && videoTags[0].id !== undefined ? videoTags[0].id : null);
    315                                     service.Request("luna://com.webos.service.tv.signage/", {
    316                                         method : "getVideoSize",
    317                                         onSuccess : function(resultx) {
    318                                             log("setVideoSize: On Success 1");
    319
    320                                             if (resultx.returnValue === true) {
    321
    322                                                 Video.currentVideo.source = resultx.videoSize.source;
    323                                                 //console.log("saved new video : " + JSON.stringify(Video.currentVideo));
    324
    325                                                 if (resultx.videoSize.source.width === 0 && resultx.videoSize.source.height === 0) {
    326
    327                                                     Video.currentVideo = {
    328                                                         uri : null,
    329                                                         source : null,
    330                                                         tagId : null
    331                                                     };
    332
    333                                                     var resultCallBack = {};
    334                                                     checkErrorCodeNText(resultCallBack, "VSVS", "Video.setVideoSize returns failure. Not ready to setVideoSize." );
    335                                                     errorCallback(resultCallBack);
    336                                                     return;
    337                                                 } else if ( Video.currentVideo.uri === null || Video.currentVideo.source === null ||
    338                                                         (options.source.width + options.source.x) > (Video.currentVideo.source.x + Video.currentVideo.source.width) ||
    339                                                         (options.source.height + options.source.y) > (Video.currentVideo.source.y + Video.currentVideo.source.height) ) {
    340
    341                                                     var resultCallBack2 = {};
    342                                                     checkErrorCodeNText(resultCallBack2, "VSVS", "Video.setVideoSize returns failure. out of range or type error."
    343                                                                                        + "(" + Video.currentVideo.source.width + " : " + Video.currentVideo.source.height + ")");
    344                                                     errorCallback(resultCallBack2);
    345                                                     return;
    346
    347                                                 }
    348
    349                                                 service.Request("luna://com.webos.service.tv.signage/", {
    350                                                     method : "setVideoSize",
    351                                                     parameters : {
    352                                                         videoSize : {
    353                                                             "source": {
    354                                                                 "x": options.source.x,
    355                                                                 "y": options.source.y,
    356                                                                 "width": options.source.width,
    357                                                                 "height": options.source.height
    358                                                             },
    359                                                             "destination": {
    360                                                                 "x": cbObj.x,
    361                                                                 "y": cbObj.y,
    362                                                                 "width": cbObj.width,
    363                                                                 "height": cbObj.height
    364                                                             }
    365                                                         }
    366                                                     },
    367                                                     onSuccess : function(result) {
    368                                                         log("setVideoSize: On Success 2");
    369
    370                                                         if (result.returnValue === true && typeof successCallback === 'function') {
    371                                                             successCallback();
    372                                                             return;
    373                                                         }
    374                                                     },
    375                                                     onFailure : function(result) {
    376                                                         log("setVideoSize: On Failure 2");
    377                                                         delete result.returnValue;
    378                                                         if (typeof errorCallback === 'function') {
    379                                                             checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure. Can't current video source size.");
    380                                                             errorCallback(result);
    381                                                             return;
    382                                                         }
    383                                                     }
    384                                                 });
    385
    386                                             }
    387                                         }
    388                                     });
    389                                 } else {
    390                                     if ( Video.currentVideo.uri === null || Video.currentVideo.source === null ||
    391                                         (options.source.width + options.source.x) > (Video.currentVideo.source.x + Video.currentVideo.source.width) ||
    392                                         (options.source.height + options.source.y) > (Video.currentVideo.source.y + Video.currentVideo.source.height) ){
    393
    394                                         var resultCallBack = {};
    395                                         checkErrorCodeNText(resultCallBack, "VSVS", "Video.setVideoSize returns failure. out of range or type error."
    396                                                                           + "(" + Video.currentVideo.source.width + " : " + Video.currentVideo.source.height + ")");
    397                                         errorCallback(resultCallBack);
    398                                         return;
    399                                     }
    400
    401                                     service.Request("luna://com.webos.service.tv.signage/", {
    402                                         method : "setVideoSize",
    403                                         parameters : {
    404                                             videoSize : {
    405                                                 "source": {
    406                                                     "x": options.source.x,
    407                                                     "y": options.source.y,
    408                                                     "width": options.source.width,
    409                                                     "height": options.source.height
    410                                                 },
    411                                                 "destination": {
    412                                                     "x": cbObj.x,
    413                                                     "y": cbObj.y,
    414                                                     "width": cbObj.width,
    415                                                     "height": cbObj.height
    416                                                 }
    417                                             }
    418                                         },
    419                                         onSuccess : function(result) {
    420                                             log("setVideoSize: On Success 3");
    421
    422                                             if (result.returnValue === true && typeof successCallback === 'function') {
    423                                                 successCallback();
    424                                                 return;
    425                                             }
    426                                         },
    427                                         onFailure : function(result) {
    428                                             log("setVideoSize: On Failure 3");
    429                                             delete result.returnValue;
    430                                             if (typeof errorCallback === 'function') {
    431                                                 checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure. Can't current video source size.");
    432                                                 errorCallback(result);
    433                                                 return;
    434                                             }
    435                                         }
    436                                     });
    437                                 }
    438                             },
    439                             onFailure : function(result) {
    440                                 log("setVideoSize: On Failure 3");
    441                                 delete result.returnValue;
    442                                 if (typeof errorCallback === 'function') {
    443                                     checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure. Can't set current video source size.");
    444                                     errorCallback(result);
    445                                     return;
    446                                 }
    447                             }
    448                         });
    449                     } else {
    450
    451                         if ( Video.currentVideo.uri === null || Video.currentVideo.source === null ||
    452                                 (options.source.width + options.source.x) > (Video.currentVideo.source.x + Video.currentVideo.source.width) ||
    453                                 (options.source.height + options.source.y) > (Video.currentVideo.source.y + Video.currentVideo.source.height) ) {
    454
    455                             var resultCallBack = {};
    456                             checkErrorCodeNText(resultCallBack, "VSVS", "Video.setVideoSize returns failure. out of range or type error."
    457                                                               + "(" + Video.currentVideo.source.width + " : " + Video.currentVideo.source.height + ")");
    458                             errorCallback(resultCallBack);
    459                             return;
    460                         }
    461
    462                         service.Request("luna://com.webos.service.tv.signage/", {
    463                             method : "setVideoSize",
    464                             parameters : {
    465                                 videoSize : {
    466                                     "source": {
    467                                         "x": options.source.x,
    468                                         "y": options.source.y,
    469                                         "width": options.source.width,
    470                                         "height": options.source.height
    471                                     },
    472                                     "destination": {
    473                                         "x": cbObj.x,
    474                                         "y": cbObj.y,
    475                                         "width": cbObj.width,
    476                                         "height": cbObj.height
    477                                     }
    478                                 }
    479                             },
    480                             onSuccess : function(result) {
    481                                 log("setVideoSize: On Success 4");
    482
    483                                 if (result.returnValue === true && typeof successCallback === 'function') {
    484                                     successCallback();
    485                                     return;
    486                                 }
    487                             },
    488                             onFailure : function(result) {
    489                                 log("setVideoSize: On Failure 4");
    490                                 delete result.returnValue;
    491                                 if (typeof errorCallback === 'function') {
    492                                     checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure. Can't current video source size.");
    493                                     errorCallback(result);
    494                                     return;
    495                                 }
    496                             }
    497                         });
    498                     }
    499
    500
    501                 }
    502             },
    503             onFailure : function(result) {
    504                 log("setVideoSize: On Failure");
    505                 delete result.returnValue;
    506                 if (typeof errorCallback === 'function') {
    507                     checkErrorCodeNText(result, "VSVS", "Video.setVideoSize returns failure.");
    508                     errorCallback(result);
    509                     return;
    510                 }
    511             }
    512         });
    513
    514         log("Video.setVideoSize Done");
    515     };
    516
    517     /**
    518      * Sets content rotation.
    519      * Note : Only full screen video rotation is supported. <br>
    520      * @class Video
    521      * @param {Function} successCallback success callback function.
    522      * @param {Function} errorCallback failure callback function.
    523      * @param {Object} options
    524      *
    525      * <div align=left>
    526      * <table class="hcap_spec" width=400>
    527      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead>
    528      *   <tbody>
    529      *       <tr><th>degree</th><th>String</th><th>"off", "90", or "270"</th><th>required</th></tr>
    530      *       <tr class="odd"><tr><th>aspectRatio</th><th>String</th><th>"full" or "original" </th><th>required</th></tr>
    531      *   </tbody>
    532      * </table>
    533      *
    534      * @return <p>If the method is successfully executed, success callback function is called without a parameter.</br>
    535      * If an error occurs, failure callback function is called with a failure callback object as a parameter.</p>
    536      * @example
    537      * // Javascript code
    538      * function setContentRotation () {
    539      *   var options = {degree : "90", aspectRatio : "full"};
    540      *
    541      *   function successCb() {
    542      *      // Do something
    543      *   }
    544      *
    545      *   function failureCb(cbObject) {
    546      *      var errorCode = cbObject.errorCode;
    547      *      var errorText = cbObject.errorText;
    548      *      console.log ("Error Code [" + errorCode + "]: " + errorText);
    549      *   }
    550      *
    551      *   var video = new Video();
    552      *   video.setContentRotation(successCb, failureCb, options);
    553      * }
    554      * @deprecated
    555      * <p>This function is removed since 1.4. Use transform properties of CSS instead.</p>
    556      * @since 1.3
    557      * @see
    558      * <a href="Video%23getContentRotation.html">Video.getContentRotation()</a><br>
    559      */
    560     Video.prototype.setContentRotation = function(successCallback, errorCallback, options) {
    561         var ret = {};
    562
    563         checkErrorCodeNText(ret, "ERROR", "This function is not supported by this version");
    564         if (typeof errorCallback === 'function')
    565             errorCallback(ret);
    566
    567         return;
    568     };
    569
    570     /**
    571      * Gets content rotation status.
    572      * @class Video
    573      * @param {Function} successCallback success callback function.
    574      * @param {Function} errorCallback failure callback function.
    575      * @return {Object}
    576      * <div align=left>
    577      * <table class="hcap_spec" width=400>
    578      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead>
    579      *   <tbody>
    580      *       <tr><th>degree</th><th>String</th><th>"off", "90", or "270"</th><th>required</th></tr>
    581      *       <tr class="odd"><tr><th>aspectRatio</th><th>String</th><th>"full" or "original" </th><th>required</th></tr>
    582      *   </tbody>
    583      * </table>
    584      *
    585      * @example
    586      * // Javascript code
    587      * function getContentRotation () {
    588      *   function successCb(cbObject) {
    589      *      console.log("cbObject : " + JSON.stringify(cbObject.source));
    590      *
    591      *      console.log("degree : " + cbObject.degree);
    592      *      console.log("aspectRatio : " + cbObject.aspectRatio);
    593      *
    594      *      // Do something
    595      *   }
    596      *
    597      *   function failureCb(cbObject) {
    598      *      var errorCode = cbObject.errorCode;
    599      *      var errorText = cbObject.errorText;
    600      *      console.log ("Error Code [" + errorCode + "]: " + errorText);
    601      *   }
    602      *
    603      *   var video = new Video();
    604      *   video.getContentRotation(successCb, failureCb);
    605      * }
    606      * @deprecated
    607      * <p>This function is removed since 1.4. Use transform properties of CSS instead.</p>
    608      * @since 1.3
    609      * @see
    610      * <a href="Video%23setContentRotation.html">Video.setContentRotation()</a><br>
    611      */
    612     Video.prototype.getContentRotation = function(successCallback, errorCallback) {
    613         var ret = {};
    614
    615         checkErrorCodeNText(ret, "ERROR", "This function is not supported by this version");
    616         if (typeof errorCallback === 'function')
    617             errorCallback(ret);
    618
    619         return;
    620     };
    621
    622     /**
    623      * Sets output size and position
    624      * @class Video
    625      * @param {Function} successCallback success callback function.
    626      * @param {Function} errorCallback failure callback function.
    627      * @param {Object} options
    628      *
    629      * <div align=left>
    630      * <table class="hcap_spec" width=400>
    631      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead>
    632      *   <tbody>
    633      *       <tr><th>x</th><th>String</th><th>Postion of x-axis in video</th><th>required</th></tr>
    634      *       <tr class="odd"><tr><th>y</th><th>String</th><th>Postion of y-axis in video</th><th>required</th></tr>
    635      *       <tr><th>width</th><th>String</th><th>Width of size in video</th><th>required</th></tr>
    636      *       <tr class="odd"><tr><th>height</th><th>String</th><th>Height of size in video</th><th>required</th></tr>
    637      *   </tbody>
    638      * </table>
    639      *
    640      * @return <p>If the method is successfully executed, success callback function is called without a parameter.</br>
    641      * If an error occurs, failure callback function is called with a failure callback object as a parameter.</p>
    642      * @example
    643      * // Javascript code
    644      * function setVideoViewTransform() {
    645      *
    646      *     var successCb = function (){
    647      *         // Do Something
    648      *     }
    649      *
    650      *     var failureCb = function(){
    651      *         var errorCode = cbObject.errorCode;
    652      *         var errorText = cbObject.errorText;
    653      *         console.log ("Error Code [" + errorCode + "]: " + errorText);
    654      *     }
    655      *
    656      *     var video = new Video();
    657
    658      *     video.setVideoViewTransform(successCb, failureCb, {
    659      *         //Portrait Standard
    660      *         x: 0,
    661      *         y: 0,
    662      *         width: 1920,
    663      *         height: 600
    664      *     });
    665      * }
    666      * @deprecated
    667      * <p>This function is removed since 1.4. Use object-fit properties of CSS instead.</p>
    668      * @since 1.3
    669      * @see
    670      * <a href="Video%23setContentRotation.html">Video.setContentRotation()</a><br>
    671      */
    672     Video.prototype.setVideoViewTransform = function(successCallback, failureCallback, options) {
    673         var ret = {};
    674
    675         checkErrorCodeNText(ret, "ERROR", "This function is not supported by this version");
    676         if (typeof failureCallback === 'function')
    677             failureCallback(ret);
    678
    679         return;
    680     };
    681
    682     /**
    683      * Sets position and size of rotated video.<br>
    684      * Note : This feature is supported after setting of rotated video by setContentRotation.<br>
    685      *
    686      * @class Video
    687      * @param {Function} successCallback success callback function.
    688      * @param {Function} errorCallback failure callback function.
    689      * @param {Object} options
    690      * <div align=left>
    691      * <table class="hcap_spec" width=400>
    692      *   <thead><tr><th>Property</th><th>Type</th><th>Description</th><th>Required</th></tr></thead>
    693      *   <tbody>
    694      *       <tr><th>x</th><th>String</th><th>Postion of x-axis in video</th><th>required</th></tr>
    695      *       <tr class="odd"><tr><th>y</th><th>String</th><th>Postion of y-axis in video</th><th>required</th></tr>
    696      *       <tr><th>width</th><th>String</th><th>Width of size in video</th><th>required</th></tr>
    697      *       <tr class="odd"><tr><th>height</th><th>String</th><th>Height of size in video</th><th>required</th></tr>
    698      *   </tbody>
    699      * </table>
    700      *
    701      * @return <p>If the method is successfully executed, success callback function is called without a parameter.</br>
    702      * If an error occurs, failure callback function is called with a failure callback object as a parameter.</p>
    703      * @example
    704      * // Javascript code
    705      * function setRotatedVideoTransform() {
    706      *     var successCb = function (){
    707      *     // Do Something
    708      *     }
    709      *
    710      *     var failureCb = function(cbObject){
    711      *         var errorCode = cbObject.errorCode;
    712      *         var errorText = cbObject.errorText;
    713      *         console.log ("Error Code [" + errorCode + "]: " + errorText);
    714      *     }
    715      *
    716      *     var video = new Video();
    717      *
    718      *     video.setRotatedVideoTransform(successCb, failureCb, {
    719      *         //Portrait Standard
    720      *         x: 100,
    721      *         y: 120,
    722      *         width: 900,
    723      *         height: 600
    724      *     });
    725      * }
    726      * @deprecated
    727      * <p>This function is removed since 1.4. Use object-fit properties of CSS instead.</p>
    728      * @since 1.3
    729      * @see
    730      * <a href="Video%23setContentRotation.html">Video.setContentRotation()</a><br>
    731      */
    732     Video.prototype.setRotatedVideoTransform = function(successCallback, failureCallback, options) {
    733         var ret = {};
    734
    735         checkErrorCodeNText(ret, "ERROR", "This function is not supported by this version");
    736         if (typeof failureCallback === 'function')
    737             failureCallback(ret);
    738
    739         return;
    740     };
    741
    742     module.exports = Video;
    743 });
    744
    745 Video = cordova.require('cordova/plugin/video'); // jshint ignore:line
    746
    747