This project is a Web Component which act as the remote control receiver of the Progressive Web App of DeckDeckGo .
Once added in your project it will add the two following two main features:
- It create a real-time communication channel using WebRTC with the Progressive Web App of DeckDeckGo
- It add a canvas over the content which will reflect what will be drawn in the Progressive Web App
Start you new presentation by following the quick 👉 Getting Started guide 👈
To create easily your PWA presentation and to enjoy all the options, I suggest you to use the starter kit as described in the documentation.
However, if you wish to use this Web Component as a standalone component to add a remote control to your DeckDeckGo's presentation you would have installed as standalone too, install it as the following:
Install it in your project from npm using the following command:
npm install deckdeckgo-remote
It's recommended to use unpkg to use this component from a CDN. To do so, add the following include script in the main HTML file of your project:
<script src="https://unpkg.com/deckdeckgo-remote@latest/dist/deckdeckgo-remote.js"></script>
The Stencil documentation provide examples of framework integration for Angular, React, Vue and Ember.
This Web Component could be integrated and used like the following:
<deckgo-remote room="my_presentation" width="300" height="200" slides="5"></deckgo-remote>
For a more concrete example you could have a look to the DeckDeckGo Starter-kit
The following options should be set using attributes:
Attribute | Type | Description |
---|---|---|
room | string | The room respectively the presentation's name which will be displayed to the user in the app when he/she will search for presentations to connect to |
socketUrl | string | A socket URI, in case you would implement your own signaling server |
width | number | The width of the canvas |
height | number | The height of the canvas |
length | number | How many slides contains your deck, this is useful to inform the app about it and initialize the length of the canvas |
slides | string[] | The ordered list of all the tag names of the slides. Useful if you would like to inform the app about which slides are used in your deck. |
autoConnect | boolean | If you the component to not connect itself on load, set this property to false |
Furthermore to attributes, this Web Component exposes methods too.
Note: For description purpose, we reference a remote
object we would have been initialized like the following in Vanilla Javascript:
const remote = document.getElementsByTagName('deckgo-remote');
Connect will open a socket with the signaling server and create a room for the presentation. If an application would wait for such a room, it will also inform this application that the receiver is yet available in order to establish the WebRTC connection.
await remote.connect();
Disconnect will close the socket with the signaling server and remove the deck from the list of possible deck to connect to.
await remote.disconnect();
You might need to move the canvas, this method let's you move it.
await remote.moveDraw(leftOffset, transitionDuration);
If you would slide in your presentation, you could call this method in order to send the information to the application, in order to reflect the slide change in the application too.
await remote.nextSlide();
If you would slide in your presentation, you could call this method in order to send the information to the application, in order to reflect the slide change in the application too.
await remote.prevSlide();
This method will emit an event from the deck to slide to a specific slide.
await remote.slideTo(0); // parameters: index: number, speed?: number | undefined
This method will emit an event from the deck to the remote in order to update the list of slides.
await remote.updateSlides();
This method will delete the current slide in the remote app.
await remote.deleteSlide();
This method will emit an event to update a particular slide in the remote.
await remote.updateSlides(index, slideDefinition);
This method will emit an event to update the reveal settings of the deck of the remote.
await remote.updateReveal(reveal);
This method will tell the remote app that the play action was performed in the deck.
await remote.play();
This method will tell the remote app that the pause action was performed in the deck.
await remote.pause();
MIT © David Dal Busco and Nicolas Mattia