Dailymotion Chat javascript plugin
Import via CDN
Usage
Instanciate chat plugin:
var c = options;
Here is an overview of defaults values for options:
var c = owner: null // Username of chat owner (required) name: null // Name of your room (required) placeholder: documentbody // Chat placeholder (DOM element) styles: 'live' // Chat's styling (live || games) api_key: null // Dailymotion API key mobile: false // Mobile version onLogged: null // After login callback function onLogin: null // Function provided to handle login access_token: null // DM access_token (to prevent popup login) api_endpoint: null // Api endpoint (ex: stage-01.dailymotion.com) grosminet_endpoint: null // Grosminet endpoint (ex: http://dmchat.dailymotion.com:80) wordsBlacklist: 'word1' 'word2' // Array of words to blacklist (will appear as *****) debug: false // Enable or disable console.log with debug;
Available function:
c;
skin parameter should be equal to 'light' or 'dark'
Commands
Mute user
/mute username
/mute @username
Unmute
/unmute username
/unmute @username
Ban
/ban username
/ban @username
Unban
/unban username
/unban @username
Reply to last mention
/r
Dailymotion Chat React component
Install
npm install dailymotion-live-chat --save
Usage
See example, in example/ folder.
let React = ;let DmChat = ; React;
Development
Install
Install all dependencies...
$ npm install
...and rename sample.config.js to dev.config.js
cp app/scripts/config/sample.config.js app/scripts/config/dev.config.js
Run development server
$ gulp dev
Gulp will start a webpack dev server with hot-reload at port 9099.
You can define a port with $ gulp --port 3333
.
An online version of grominet backend is available at 'http://dmchat.dailymotion.com:80 You can still build grominet locally (live-chat backend https://github.com/dailymotion/grosminet), and specify the right url in config.js (GROMINET_ENDPOINT)
Build
Builds a minified version of the js plugin + react component + embed version (with assets from npmcdn.com)
$ gulp build