Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Synchronizing video play between two peers.

When two browsers are playing the same web video, Coplay can connect them with WebRTC (using PeerJS) and enable users to control two video players synchronously.

Coplay now works on Youku, Sohu TV, Tencent Video, Tudou, iQiyi, YouTube, AcFun, bilibili, LETV and Vimeo.
Coplay now works on Youku, Sohu TV, Tencent Video, Tudou, iQiyi, rijula, YouTube, AcFun, bilibili, LETV and Vimeo.

Buttons on control bar stands for "connect", "play", "pause", "sync", "restart", "fullscreen" and "video chat".

Expand Down Expand Up @@ -41,4 +41,4 @@ For HTTPS sites, users can use video calls to video chat with each other while w

* Why Peer ID doesn't show up on Youtube?

Youtube uses HTTPS but PeerJS (the WebRTC service which Coplay rely on) will make some HTTP requests, which are blocked by browsers' security policies. You can 1. enable default HTTPS server in the options or 2. set up your custom PeerJS server with HTTPS support.
Youtube uses HTTPS but PeerJS (the WebRTC service which Coplay rely on) will make some HTTP requests, which are blocked by browsers' security policies. You can 1. enable default HTTPS server in the options or 2. set up your custom PeerJS server with HTTPS support.da
72 changes: 66 additions & 6 deletions extensions/chrome/coplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

// Supported websites: Youku, SohuTV, Tudou, TencentVideo, iQiyi, YouTube, ACFun, bilibili, MGTV, Vimeo
let host = location.host.match(
/(?:^|\.)(youku\.com|sohu\.com|tudou\.com|qq\.com|iqiyi\.com|youtube\.com|acfun\.cn|bilibili\.com|mgtv\.com|vimeo\.com)(?:\/|$)/i
/(?:^|\.)(youku\.com|sohu\.com|tudou\.com|qq\.com|iqiyi\.com|youtube\.com|acfun\.cn|bilibili\.com|mgtv\.com|vimeo\.com|rijula\.com|dililitv\.com|dililitv\.cc)(?:\/|$)/i
);

if (!host) {
return;
}
Expand Down Expand Up @@ -231,6 +232,8 @@
playerAdaptor.iqiyi = {
prepare() {
this._player = query('.iqp-player video');
console.log('in prepare iqiyi');
console.log(this._player)
},
play() {
this._player.play();
Expand Down Expand Up @@ -395,9 +398,65 @@
query('.fullscreen').click();
}
};

playerAdaptor.dililitv = {
prepare() {
this._player = query('.dplayer-video-wrap video');
},
play() {
this._player.play();
},
pause() {
this._player.pause();
},
seek(sec) {
this._player.currentTime = sec;
},
isReady() {
return this._player.readyState === 4;
},
getTime() {
return this._player.currentTime;
},
toggleFullscreen() {
if (fullscreen()) {
this._player.exitWindowFullscreen();
} else {
this._player.enterWindowFullscreen();
}
}
}
playerAdaptor.rijula = {
prepare() {
this._player = query('.dplayer-video-wrap video',document.getElementById("fed-play-iframe").contentWindow.document);
},
play() {
this._player.play();
},
pause() {
this._player.pause();
},
seek(sec) {
this._player.currentTime = sec;
},
isReady() {
return this._player.readyState === 4;
},
getTime() {
return this._player.currentTime;
},
toggleFullscreen() {
if (fullscreen()) {
this._player.exitFullscreen();
} else {
this._player.fullScreen();
}
}
};
playerAdaptor.mgtv = {
prepare() {
this._player = MGTVPlayer.getPlayer();
// this._player = MGTVPlayer.getPlayer();
this._player = query("#mgtv-player-wrap video");
},
play() {
this._player.play();
Expand All @@ -406,10 +465,10 @@
this._player.pause();
},
seek(sec) {
this._player.seek(sec);
this._player.currentTime = sec;
},
isReady() {
return this._player.state === 4;
return this._player.readyState === 4;
},
getTime() {
return this._player.currentTime;
Expand Down Expand Up @@ -452,6 +511,7 @@
};

function initPlayer(done) {

let player = Object.assign({}, playerBase, playerAdaptor[host]);

(function init() {
Expand Down Expand Up @@ -766,7 +826,7 @@
coplay.media = media;
let ui = coplay.ui;
media.on('stream', stream => {
ui.remoteVideo.src = window.URL.createObjectURL(stream);
ui.remoteVideo.srcObject = stream;
ui.localVideo.hidden = false;
ui.remoteVideo.hidden = false;
ui.call.hidden = true;
Expand Down Expand Up @@ -966,7 +1026,7 @@
stream => {
coplay.stream = stream;
initVideoCallPlayers();
coplay.ui.localVideo.src = window.URL.createObjectURL(stream);
coplay.ui.localVideo.srcObject = stream;
if (typeof remote === 'string') {
// peer id
let media = coplay.peer.call(remote, stream);
Expand Down
2 changes: 1 addition & 1 deletion extensions/chrome/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function checkAutoInject() {
url: [
{
urlMatches:
'(?:^|.)(youku.com|sohu.com|tudou.com|qq.com|iqiyi.com|youtube.com|acfun.cn|bilibili.com|mgtv.com|vimeo.com)(?:/|$)'
'(?:^|.)(youku.com|sohu.com|tudou.com|qq.com|iqiyi.com|youtube.com|acfun.cn|bilibili.com|mgtv.com|vimeo.com|rijula.com)(?:/|$)'
}
]
});
Expand Down
7 changes: 6 additions & 1 deletion extensions/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
"https://*.acfun.cn/*",
"http://*.bilibili.com/*",
"https://*.bilibili.com/*",
"http://*.dililitv.com/*",
"https://*.dililitv.com/*",
"https://*.dililitv.cn/*",
"http://*.mgtv.com/*",
"https://*.mgtv.com/*",
"http://*.vimeo.com/*",
"https://*.vimeo.com/*",
"https://*.rijula.com/*",
"http://*.rijula.com/*",
"activeTab",
"webNavigation",
"storage",
Expand Down Expand Up @@ -54,4 +59,4 @@
"page": "options.html",
"chrome_style": true
}
}
}