Forum

Mathieu Roll
      Has successfully completed the online course Introduction
      Has successfully completed the online course Intermediate (200)
      Has successfully completed the online course Advanced (300)
      Has successfully completed the online course Basics (100)
    5 years ago #17825
    Up
    1
    Down
    ::

    Hello,

    in Simplifier 5.0 there will be a new Mobile Action for Recording Videos.

    But the way to do this with 4.5 is by script or client side business object.

    var captureVideo = function(oParameters, fnSucceed, fnFail) {
        if (typeof navigator === "undefined" || !navigator.device || !navigator.device.capture || !navigator.device.capture.captureVideo) {
            fnFail("Capture video is not defined!");
            return;
        }
        if (typeof window.resolveLocalFileSystemURL !== "function") {
            fnFail("Function resolveLocalFileSystemURL is not defined!");
            return;
        }
        var oConfig = $.extend({
            "limit": 1,
    	"duration" : 60
        }, oParameters);
        if (typeof oConfig.limit !== "number") {
            oConfig.limit = parseInt(oConfig.limit, 10);
        }
    
    	if (typeof oConfig.duration !== "number") {
            oConfig.duration = parseInt(oConfig.duration, 10);
        }
    
        var fnCaptureVideoCallback = function(aMediaFiles) {
            var oResponseData = {};
            if (aMediaFiles.length > 0) {
                var oVideo = aMediaFiles[0];
                oResponseData.name = oVideo.name;
                oResponseData.fullPath = oVideo.fullPath;
                oResponseData.lastModifiedDate = oVideo.lastModifiedDate;
                oResponseData.size = oVideo.size;
                oResponseData.type = oVideo.type;
                resolveLocalFileSystemURL(oVideo.localURL, function(oEntry) {
                    oResponseData.fileUrl = oEntry.toURL();
                    fnSucceed(oResponseData);
                });
            }
        };
        navigator.device.capture.captureVideo(fnCaptureVideoCallback, fnFail, oConfig);
    };
    
    var oParameters = {limit: 1, duration: 60};
    
    captureVideo(oParameters, function(data) {
        console.log("onSuccess");
    }, function(msg) {
        console.log("onError", msg);
    });