|
Note: This example requires npm to be installed (installed with Node.js) and Git for installation of Bower packages. Supported browsers are Google Chrome, Mozilla Firefox, and Opera. |
Run the following commands from the sample directory, <Wwise installation path>/SDK/samples/WwiseAuthoringAPI/js/hello-wwise-web-wamp
, to install dependencies.
npm install -g bower bower install autobahn
The sample file, index.js in the hello-wwise-web-wamp
sample directory allows to connect to the Wwise Authoring API.
var showMessage = function(message){ document.getElementById("message").innerHTML = message; } function onBodyLoad() { // Create the WAMP connection var connection = new autobahn.Connection({ url: 'ws://localhost:8080/waapi', realm: 'realm1', protocols: ['wamp.2.json'] }); // Setup handler for connection closed connection.onclose = function (reason, details) { showMessage('wamp connection closed'); return true; }; // Setup handler for connection opened connection.onopen = function (session) { showMessage('wamp connection opened'); // Call getInfo session.call(ak.wwise.core.getInfo, [], {}).then( function (res) { showMessage(`Hello ${res.kwargs.displayName} ${res.kwargs.version.displayName}`); }, function (error) { showMessage(`error: ${error}`); } ); }; // Open the connection connection.open(); }
The sample file, index.html, in the hello-wwise-web-wamp
sample directory is a simple webpage which uses the previous script to connect to the Wwise Authoring API and renders the output message.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Hello Wwise</title> <script src="bower_components/autobahnjs/autobahn.js"></script> <script src="../../../../include/AK/WwiseAuthoringAPI/js/waapi.js"></script> <script src="index.js"></script> </head> <body onload="onBodyLoad()"> <div id="message"> Not connected. </div> </body> </html>
Double-click index.html to open in a supported browser.
If the Wwise Authoring API successfully connects to Wwise, you should see the following output:
Hello Wwise 20??.?.?
프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.
Wwise를 시작해 보세요