muaz-khan / Canvas-Designer

Collaborative, extendable, JavaScript Canvas2D drawing tool, supports dozens of builtin tools, as well as generates JavaScript code for 2D animations.
https://www.webrtc-experiment.com/Canvas-Designer/
MIT License
368 stars 171 forks source link

does this work with safari ? #28

Open amikar opened 7 years ago

amikar commented 7 years ago

I am trying to make the connection work with safari but there seems to be a connection issue. The application works fine with chrome and firefox. does webrtc not work with safari ?

muaz-khan commented 7 years ago

Only WebRTC 1.0 compatible browsers are supported:

  1. Chrome (both desktop and Android)
  2. Firefox (both desktop and Android)
  3. Opera (both desktop and Android)

Following are NOT supported:

  1. Chrome on iOS
  2. Safari on any platform
  3. IE or MSEdge

To support Safari+IE+MSEdge, you can use socket.io as signaling. In this case, CanvasDesigner will share/sync data using socket.io instead of using WebRTC.

You can check WebSocket usage here:

You can use any method: PHP-XHR-polling; socket.io; websockets; XMPP etc.

Here is socket.io usage:

socketio.on('messgae', function(data) {
    designer.syncData(data);
});

designer.addSyncListener(function(data) {
    socketio.emit('data', data);
});

Or complete usage:

var designer = new CanvasDesigner();

socketio.on('messgae', function(data) {
    designer.syncData(data);
});

designer.addSyncListener(function(data) {
    socketio.emit('data', data);
});

designer.setSelected('pencil');

designer.setTools({
    pencil: true,
    text: true
});

designer.appendTo(document.documentElement);