dailymotion-live-chat

1.10.2 • Public • Published

Dailymotion Chat javascript plugin

Import via CDN

<script src="https://npmcdn.com/dailymotion-live-chat/dist/embed/js/dailymotion-live-chat.js"></script>

Usage

Instanciate chat plugin:

var c = new window.DmChat(options);

Here is an overview of defaults values for options:

var c = new window.DmChat({
  owner: null,                          // Username of chat owner (required)
  name: null,                           // Name of your room (required)
  placeholder: document.body,           // 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.changeSkin(skin);

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 = require('react');
let DmChat = require ('dailymotion-live-chat');
 
React.render(
  <DmChat
    name="x2ns1iw"
    ownerUsername="httpete"
    styles="games"
  />
, document.querySelector('.chat-placeholder'));

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

Readme

Keywords

Package Sidebar

Install

npm i dailymotion-live-chat

Weekly Downloads

4

Version

1.10.2

License

MIT

Last publish

Collaborators

  • httpete