Ace Stream JavaScript Library provides tools to embed video player on web-pages with minimum effort.
The latest version with some documentation and examples is available [http== Example of using Ace Stream Javascript API to embed player on the page. ==First, add javascript library on the page (inside the <head> tag): <tt><script src="//static.acestream.net/demosjsapi/embeddingacestream.min.js"></index.html here]script></tt>
On Then you can create the player with this page detailed technical documentation code: <tt><nowiki> var playerContext = null; AceStream.createPlayer("#player", { onLoad: function (player) { playerContext = player; playerContext.loadContentId("94c2fd8fb9bc8f2fc71a2cbe9d4b866f227a0209"); }, onError: function(err) {console.log("init: error: " + err);} }); </nowiki></tt>Player is created in the HTML-container with id "player". Upon successful player creation '''onLoad''' callback is called and player object is passed as parameter.You should save player object to some variable to be able to call player methods later, for example, to switch to another content.Currently such method are available:*<tt>loadContentId(contentId)</tt> - load by Content ID (unique identified in Ace Stream system);*<tt>loadTransportFileUrl(url)</tt> - load by transport file URL;*<tt>loadInfohash(infohash)</tt> - load by infohash;*<tt>loadMagnet(magnetUri)</tt> - load by magnet link;*<tt>loadDirectUrl(url)</tt> - load by direct content URL (this can be direct link to some video file, HLS stream or link supported by Ace Stream plugins: youtube, twitch etc). Buttons on the top of the pages show how to use different content loading methods. Working example is available [http://acestream.net/demos/embedding/index.html here] ==Additional features==If the user has a browser extension Ace Script with the activated userscript Ace Cast, the library following additional features will be providedavailable:* Automatically start Ace Stream application for content playback (there is no need to manually start the application if it isn't running)* Select any installed desktop player for playback* Playback content on remote devices over protocols Ace Cast, Google Cast, AirPlay and others* Add content to user's playlist, in his Ace Stream personal media server* Convenient ways to share contentIn order to inform the user about these features, the corresponding information block is shown after clicking on "menu" or "play" button. Attention! The need to use a browser extension and a userscript to make additional features available is temporary, until we implement a solution that allows direct and secure communication between javascript code and the Ace Stream application. == Roadmap ==New JS API consists of reusable javascript modules which are bundled with browserify. Currently only the bundled version is distributed, but we plan to prepare documentation for these modules and publish it along with the source code on github. Modules will implement such functionality like:* checking engine status and version and running it if necessary* encapsulate all avaialble Ace Stream HTTP API methods* provide reusable markup* etc == Legacy JS API ==The old version of JS API is still available. You can find test page and links [http://acestream.net/demos/embedding/index-legacy.html here.]