Hello,
I have included a Chrome Packaged App I'd like to share, which uses a slightly modified sipML5 codebase to ensure it will run in Chrome's sandboxed environment and use the correct storage APIs for whatever environment sipML5 is running in. I'm really hoping the changes I made to the sipML5 codebase can eventually be incorporated into the main tree, as this will make it easier for extension developers and Web developers to work together with this evolving codebase.
Here is a summary of changes:
- Created a storageAPI.js wrapper around all window.localStorage calls in sipML5 called "storageAPI". The JavaScript will determine at runtime whether or not sipML5 is running in the browser or if it's running in a Chrome Packaged app. If it's in the browser, all storage API calls use window.localStorage. If it's an extension/app, it uses chrome.storage.local APIs and passes the stored data from the app to the sandboxed environment.
- Moved all of the inline JavaScript from the call.htm and the expert.htm file to new JavaScript files called sipml5-api-util.js and expert.js. Chrome's new manifest version 2 requires that all code be included in separate JS files.
- Created a wrapper HTML file to switch between the softphone and expert mode, since navigation in packaged apps is disabled, or at least very tricky.
I verified that I can make calls from Canary both with the code installed as an app as well as by hosting the code on an HTTP server. No modifications were needed to switch from using the sipML5 code via HTTP or inside a Packaged App. These changes are helpful for the following reasons:
Benefits:
- Web developers will still seamlessly use and update sipML5, without modifications.
- Extension developers will also be able to use sipML5, without modifications, when the sipML5 library is updated.
Instructions:
- First, if you do not have Canary, you can get it here: https://tools.google.com/dlpage/chromesxs
- Launch Canary.
- In your address bar, go to chrome://flags
- Make sure the following API's are enabled: MediaSource, PeerConnection, Experimental APIs.
- Restart the browser if you had to make changes to the flags.
- In the "Tools" menu, select "Extensions"
- In the Extensions Manager, at the top, make sure "Developer Mode" is checked.
- Click "Load unpacked extension..."
- Browse to the location where you extracted the extension tarball and install.
If everything goes fine, you should see an icon on the "chrome://newtab" page, which you can get to simply by opening a new tab and making sure "Apps" is selected in the footer. Launch the app.
If all goes well, and you've been following along with the sipML5 development, you should see the sipML5 softphone client in it's own window. Use the "Expert Mode" button at the top instead of the one below the registration panel.
Please let me know your feedback or if there are any questions or problems.
James