Load external libraries and SDK with appcelerator hyperloop

409 Views Asked by At

I'm working on a iOS and Android DVR app with remote controls. I need to use a third-party library for network communication and video encoding, via hyperloop programming.

At the moment I tried importing the iOS version libraries. The library consists of a static file libDVR_NET_SDK.a and a "include" folder with several .h header files inside.

I followed the official documentation by creating the references in the appc.js file:

appcelerator.com iOS Hyperloop Programming Guide

module.exports = {
    hyperloop: {
        ios: {
            thirdparty: {
                'libDVR_NET_SDK': {
                    source: 'platform/ios/SDK/include',
                    header: "platform/ios/SDK/include",
                    resource: 'platform/ios/SDK'
                },
                'MediaPlayerLib': {
                    source: 'platform/ios/MediaPlayerLib/include',
                    header: "platform/ios/MediaPlayerLib/include",
                    resource: 'platform/ios/MediaPlayerLib'
                }
            }
        }
    }
};

I can not understand how to call the external library from javascript code, at the moment I tried:

var libDVR_NET_SDK = require("libDVR_NET_SDK");

But the following error is generated:

Script Error Couldn't find module: /hyperloop/libdvr_net_sdk/libdvr_net_sdk for architecture: x86_64
1

There are 1 best solutions below

2
On

Hyperloop docs says : This has been deprecated in Hyperloop 2.2.0 and will be removed in Hyperloop 3.0.0. Place it into your iOS platform directory instead and it will be automatically detected.

So, try putting your library in Project -> app -> platform -> ios folder & it will automatically detect it.

To use in js code, you can try to call it as mentioned in that library docs considering the names to be same as if you were calling them in native iOS.

I found similar to Android here : Hyperloop Android 3rd Party Example. It contains libraries in similar folder & you can check how it's used further in titanium app code.