-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: Ic1daf53e8701b1e7a46269096b33ebe323deab90
- Loading branch information
Showing
41 changed files
with
4,218 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,7 +243,10 @@ | |
"jsonrpc": "2.0", | ||
"id": 1, | ||
|
||
"result": * | ||
"result": | ||
{ | ||
"data": "$%&/" | ||
} | ||
} | ||
``` | ||
|
||
|
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
example/index.html → ...le/PlayerEndPoint-HttpEndPoint/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
var RTCPeerConnection = RTCPeerConnection || webkitRTCPeerConnection; | ||
|
||
|
||
window.addEventListener('load', function() | ||
{ | ||
KwsMedia('ws://192.168.0.110:7788/thrift/ws/websocket', | ||
// KwsMedia('ws://179.111.137.126:7788/thrift/ws/websocket', | ||
function(kwsMedia) | ||
{ | ||
// Create pipeline | ||
kwsMedia.createMediaPipeline(function(error, pipeline) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
// Create pipeline media elements (endpoints & filters) | ||
var type = ['PlayerEndPoint', 'HttpGetEndPoint']; | ||
var params = [{uri: "http://localhost:8000/video.avi"}, null]; | ||
|
||
pipeline.createMediaElement(type, params, | ||
function(error, mediaElements) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
var playerEndPoint = mediaElements[0]; | ||
var httpGetEndPoint = mediaElements[1]; | ||
|
||
// Connect media element between them | ||
pipeline.connect(playerEndPoint, httpGetEndPoint, | ||
function(error, pipeline) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
console.log(pipeline); | ||
}); | ||
|
||
// Subscribe to PlayerEndPoint EOS event | ||
playerEndPoint.on('EOS', function() | ||
{ | ||
console.log("EOS"); | ||
}); | ||
|
||
// Set the video on the video tag | ||
var videoOutput = document.getElementById("videoOutput"); | ||
|
||
httpGetEndPoint.getUrl(function(error, url) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
videoOutput.src = url; | ||
console.log(url); | ||
|
||
// Start player | ||
playerEndPoint.start(function(error, result) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
console.log(result); | ||
}); | ||
}); | ||
|
||
}); | ||
}); | ||
}, | ||
function(error) | ||
{ | ||
console.error('An error ocurred:',error); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
example/PlayerEndPoint-JackVaderFilter-WebRtcEndPoint/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head> | ||
<script src="../../dist/KwsMedia.js"></script> | ||
<script src="index.js"></script> | ||
</head> | ||
<body> | ||
<video id="videoOutput" autoplay /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<script src="../../dist/KwsMedia.js"></script> | ||
<script src="index.js"></script> | ||
</head> | ||
<body> | ||
<video id="videoInput" autoplay /> | ||
<video id="videoOutput" autoplay /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var RTCPeerConnection = RTCPeerConnection || webkitRTCPeerConnection; | ||
|
||
|
||
getUserMedia({'audio': true, 'video': true}, function(stream) | ||
{ | ||
var videoInput = document.getElementById("videoInput"); | ||
var videoOutput = document.getElementById("videoOutput"); | ||
|
||
videoInput.src = URL.createObjectURL(stream); | ||
|
||
|
||
KwsMedia('ws://192.168.0.110:7788/thrift/ws/websocket', | ||
function(kwsMedia) | ||
{ | ||
// Create pipeline | ||
kwsMedia.createMediaPipeline(function(error, pipeline) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
// Create pipeline media elements (endpoints & filters) | ||
pipeline.createMediaElement('WebRtcEndPoint', | ||
function(error, webRtcEndPoint) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
// Create a PeerConnection client in the browser | ||
var peerConnection = new RTCPeerConnection | ||
( | ||
{iceServers: [{url: 'stun:stun.l.google.com:19302'}]}, | ||
{optional: [{DtlsSrtpKeyAgreement: true}]} | ||
); | ||
|
||
peerConnection.addStream(stream); | ||
|
||
// Connect the pipeline to the PeerConnection client | ||
webRtcEndPoint.generateSdpOffer(function(error, offer) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
peerConnection.setRemoteDescription(offer, function() | ||
{ | ||
peerConnection.createAnswer(function(answer) | ||
{ | ||
peerConnection.setLocalDescription(answer, function() | ||
{ | ||
|
||
webRtcEndPoint.processSdpAnswer(answer, function(error) | ||
{ | ||
if(error) return console.error(error); | ||
|
||
var stream = peerConnection.getRemoteStreams()[0]; | ||
|
||
// Set the stream on the video tag | ||
videoOutput.src = URL.createObjectURL(stream); | ||
|
||
// // Start player | ||
// pipeline.start(); | ||
}); | ||
|
||
}, | ||
console.error); | ||
}, | ||
console.error); | ||
}, | ||
console.error); | ||
|
||
}); | ||
}); | ||
}); | ||
}, | ||
function(error) | ||
{ | ||
console.error('An error ocurred:',error); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* (C) Copyright 2013 Kurento (http://kurento.org/) | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the GNU Lesser General Public License | ||
* (LGPL) version 2.1 which accompanies this distribution, and is available at | ||
* http://www.gnu.org/licenses/lgpl-2.1.html | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
*/ | ||
|
||
|
||
/** | ||
* | ||
* | ||
* @module | ||
* | ||
* @copyright 2013 Kurento (http://kurento.org/) | ||
* @license LGPL | ||
*/ | ||
|
||
var MediaObject = require('./MediaObject'); | ||
|
||
|
||
/** | ||
* Represent an instance of a MediaFilter | ||
* | ||
* This is a Javascript API abstraction not available on the Media Server API | ||
* | ||
* @abstract | ||
* @class | ||
* | ||
* @param {} objectRef | ||
* @param {*} parent | ||
* @param {MediaPipeline} [pipeline] | ||
*/ | ||
function MediaFilter(objectRef, parent, pipeline, params) | ||
{ | ||
MediaObject.call(this, objectRef, parent, pipeline, params); | ||
|
||
|
||
// Bubble the event for new MediaObjects | ||
this.on('mediaObject', function(mediaObject) | ||
{ | ||
parent.emit('mediaObject', mediaObject); | ||
}); | ||
}; | ||
MediaFilter.prototype.__proto__ = MediaObject.prototype; | ||
MediaFilter.prototype.constructor = MediaFilter; | ||
|
||
|
||
/** | ||
* | ||
* @param {MediaObjectConstructorParams} params | ||
* | ||
* @throws {SyntaxError} | ||
* | ||
* @returns {MediaObjectConstructorParams} | ||
*/ | ||
MediaFilter.checkparams = function(params) | ||
{ | ||
return MediaObject.checkparams(params); | ||
}; | ||
|
||
|
||
module.exports = MediaFilter; |
Oops, something went wrong.