Skip to content

Commit 5547783

Browse files
committed
Update
1 parent 00dfd9b commit 5547783

11 files changed

+1123
-380
lines changed

channel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
sanV($n);
77
if (!$n) exit;
88

9-
$swfurl="live_watch.swf?n=".urlencode($n);
9+
$swfurl="live_watch.swf?ssl=1&n=".urlencode($n);
1010
$bgcolor="#333333";
1111
?><style type="text/css">
1212
<!--

index.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
include("header.php");
33
?>
44

5-
<div style="padding:20px"><form id="adminForm" name="adminForm" method="post" action="live_broadcast.php" onSubmit="return censorName()">
5+
<div style="padding:20px"><form id="adminForm" name="adminForm" method="get" action="live_broadcast.php" onSubmit="return censorName()">
66
<b>Provide a Label for your Channel</b><br>
77
<br>
88
Channel Name / Username
@@ -19,12 +19,21 @@ function censorName()
1919
</script>
2020

2121
<input name="username" type="text" id="username" value="Studio" size="12" maxlength="12" onChange="censorName()"/>
22-
<input type="submit" name="button" id="button" value="Publish Channel" onClick="this.disabled=true; censorName(); this.value='Loading...'; adminForm.submit();" />
22+
23+
<select name="onlyoptions" id="onlyoptions">
24+
<option value="0">Start Broadcast</option>
25+
<option value="1">Only Options</option>
26+
</select>
27+
28+
<input type="submit" name="button" id="button" value="Access Channel" onClick="this.disabled=true; censorName(); this.value='Loading...'; adminForm.submit();" />
2329
<?php
2430
include("settings.php");
2531
if (strstr($rtmp_server, "://localhost/")) echo "<P class='warning'>Warning: You are using a localhost based rtmp address ( $rtmp_server ). Unless you are just testing this with a rtmp server on your own computer, make sure you fill a <a href='http://www.videowhisper.com/?p=RTMP+Applications'>compatible rtmp address</a> in settings.php.</P>";
2632
?>
27-
</form></div>
33+
<br><small>Select Only Options (do not Start Broadcast) to access channel options including HTML5 WebRTC broadcasting.</small>
34+
</form>
35+
36+
</div>
2837

2938
<div class="info">
3039
<p><b>Suggestions</b></p>

js/adapter.js

+65-46
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
1+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.adapter = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
22
/*
33
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
44
*
@@ -1140,6 +1140,19 @@ module.exports = function(window, edgeVersion) {
11401140
}
11411141
}
11421142

1143+
// If the offer contained RTX but the answer did not,
1144+
// remove RTX from sendEncodingParameters.
1145+
var commonCapabilities = getCommonCapabilities(
1146+
transceiver.localCapabilities,
1147+
transceiver.remoteCapabilities);
1148+
1149+
var hasRtx = commonCapabilities.codecs.filter(function(c) {
1150+
return c.name.toLowerCase() === 'rtx';
1151+
}).length;
1152+
if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) {
1153+
delete transceiver.sendEncodingParameters[0].rtx;
1154+
}
1155+
11431156
pc._transceive(transceiver,
11441157
direction === 'sendrecv' || direction === 'recvonly',
11451158
direction === 'sendrecv' || direction === 'sendonly');
@@ -1555,6 +1568,8 @@ module.exports = function(window, edgeVersion) {
15551568
return t.mid;
15561569
}).join(' ') + '\r\n';
15571570
}
1571+
sdp += 'a=ice-options:trickle\r\n';
1572+
15581573
var mediaSectionsInOffer = SDPUtils.getMediaSections(
15591574
pc._remoteDescription.sdp).length;
15601575
pc.transceivers.forEach(function(transceiver, sdpMLineIndex) {
@@ -1905,6 +1920,7 @@ SDPUtils.parseCandidate = function(line) {
19051920
protocol: parts[2].toLowerCase(),
19061921
priority: parseInt(parts[3], 10),
19071922
ip: parts[4],
1923+
address: parts[4], // address is an alias for ip.
19081924
port: parseInt(parts[5], 10),
19091925
// skip parts[6] == 'typ'
19101926
type: parts[7]
@@ -1940,7 +1956,7 @@ SDPUtils.writeCandidate = function(candidate) {
19401956
sdp.push(candidate.component);
19411957
sdp.push(candidate.protocol.toUpperCase());
19421958
sdp.push(candidate.priority);
1943-
sdp.push(candidate.ip);
1959+
sdp.push(candidate.address || candidate.ip);
19441960
sdp.push(candidate.port);
19451961

19461962
var type = candidate.type;
@@ -1968,7 +1984,7 @@ SDPUtils.writeCandidate = function(candidate) {
19681984
// a=ice-options:foo bar
19691985
SDPUtils.parseIceOptions = function(line) {
19701986
return line.substr(14).split(' ');
1971-
}
1987+
};
19721988

19731989
// Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input:
19741990
// a=rtpmap:111 opus/48000/2
@@ -2101,14 +2117,24 @@ SDPUtils.parseSsrcMedia = function(line) {
21012117
return parts;
21022118
};
21032119

2120+
SDPUtils.parseSsrcGroup = function(line) {
2121+
var parts = line.substr(13).split(' ');
2122+
return {
2123+
semantics: parts.shift(),
2124+
ssrcs: parts.map(function(ssrc) {
2125+
return parseInt(ssrc, 10);
2126+
})
2127+
};
2128+
};
2129+
21042130
// Extracts the MID (RFC 5888) from a media section.
21052131
// returns the MID or undefined if no mid line was found.
21062132
SDPUtils.getMid = function(mediaSection) {
21072133
var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0];
21082134
if (mid) {
21092135
return mid.substr(6);
21102136
}
2111-
}
2137+
};
21122138

21132139
SDPUtils.parseFingerprint = function(line) {
21142140
var parts = line.substr(14).split(' ');
@@ -2285,7 +2311,7 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
22852311
if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) {
22862312
var encParam = {
22872313
ssrc: primarySsrc,
2288-
codecPayloadType: parseInt(codec.parameters.apt, 10),
2314+
codecPayloadType: parseInt(codec.parameters.apt, 10)
22892315
};
22902316
if (primarySsrc && secondarySsrc) {
22912317
encParam.rtx = {ssrc: secondarySsrc};
@@ -2294,7 +2320,7 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
22942320
if (hasRed) {
22952321
encParam = JSON.parse(JSON.stringify(encParam));
22962322
encParam.fec = {
2297-
ssrc: secondarySsrc,
2323+
ssrc: primarySsrc,
22982324
mechanism: hasUlpfec ? 'red+ulpfec' : 'red'
22992325
};
23002326
encodingParameters.push(encParam);
@@ -2330,8 +2356,7 @@ SDPUtils.parseRtpEncodingParameters = function(mediaSection) {
23302356
SDPUtils.parseRtcpParameters = function(mediaSection) {
23312357
var rtcpParameters = {};
23322358

2333-
var cname;
2334-
// Gets the first SSRC. Note that with RTX there might be multiple
2359+
// Gets the first SSRC. Note tha with RTX there might be multiple
23352360
// SSRCs.
23362361
var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
23372362
.map(function(line) {
@@ -2372,8 +2397,8 @@ SDPUtils.parseMsid = function(mediaSection) {
23722397
.map(function(line) {
23732398
return SDPUtils.parseSsrcMedia(line);
23742399
})
2375-
.filter(function(parts) {
2376-
return parts.attribute === 'msid';
2400+
.filter(function(msidParts) {
2401+
return msidParts.attribute === 'msid';
23772402
});
23782403
if (planB.length > 0) {
23792404
parts = planB[0].value.split(' ');
@@ -2393,17 +2418,20 @@ SDPUtils.generateSessionId = function() {
23932418
// sessId argument is optional - if not supplied it will
23942419
// be generated randomly
23952420
// sessVersion is optional and defaults to 2
2396-
SDPUtils.writeSessionBoilerplate = function(sessId, sessVer) {
2421+
// sessUser is optional and defaults to 'thisisadapterortc'
2422+
SDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) {
23972423
var sessionId;
23982424
var version = sessVer !== undefined ? sessVer : 2;
23992425
if (sessId) {
24002426
sessionId = sessId;
24012427
} else {
24022428
sessionId = SDPUtils.generateSessionId();
24032429
}
2430+
var user = sessUser || 'thisisadapterortc';
24042431
// FIXME: sess-id should be an NTP timestamp.
24052432
return 'v=0\r\n' +
2406-
'o=thisisadapterortc ' + sessionId + ' ' + version + ' IN IP4 127.0.0.1\r\n' +
2433+
'o=' + user + ' ' + sessionId + ' ' + version +
2434+
' IN IP4 127.0.0.1\r\n' +
24072435
's=-\r\n' +
24082436
't=0 0\r\n';
24092437
};
@@ -2513,9 +2541,24 @@ SDPUtils.parseOLine = function(mediaSection) {
25132541
sessionVersion: parseInt(parts[2], 10),
25142542
netType: parts[3],
25152543
addressType: parts[4],
2516-
address: parts[5],
2544+
address: parts[5]
25172545
};
2518-
}
2546+
};
2547+
2548+
// a very naive interpretation of a valid SDP.
2549+
SDPUtils.isValidSDP = function(blob) {
2550+
if (typeof blob !== 'string' || blob.length === 0) {
2551+
return false;
2552+
}
2553+
var lines = SDPUtils.splitLines(blob);
2554+
for (var i = 0; i < lines.length; i++) {
2555+
if (lines[i].length < 2 || lines[i].charAt(1) !== '=') {
2556+
return false;
2557+
}
2558+
// TODO: check the modifier a bit more.
2559+
}
2560+
return true;
2561+
};
25192562

25202563
// Expose public methods.
25212564
if (typeof module === 'object') {
@@ -2676,12 +2719,12 @@ module.exports = function(dependencies, opts) {
26762719
commonShim.shimCreateObjectURL(window);
26772720

26782721
safariShim.shimRTCIceServerUrls(window);
2722+
safariShim.shimCreateOfferLegacy(window);
26792723
safariShim.shimCallbacksAPI(window);
26802724
safariShim.shimLocalStreamsAPI(window);
26812725
safariShim.shimRemoteStreamsAPI(window);
26822726
safariShim.shimTrackEventTransceiver(window);
26832727
safariShim.shimGetUserMedia(window);
2684-
safariShim.shimCreateOfferLegacy(window);
26852728

26862729
commonShim.shimRTCIceCandidate(window);
26872730
commonShim.shimMaxMessageSize(window);
@@ -2818,10 +2861,14 @@ module.exports = {
28182861
}
28192862
return origSetRemoteDescription.apply(pc, arguments);
28202863
};
2821-
} else if (!('RTCRtpTransceiver' in window)) {
2864+
} else {
2865+
// even if RTCRtpTransceiver is in window, it is only used and
2866+
// emitted in unified-plan. Unfortunately this means we need
2867+
// to unconditionally wrap the event.
28222868
utils.wrapPeerConnectionEvent(window, 'track', function(e) {
28232869
if (!e.transceiver) {
2824-
e.transceiver = {receiver: e.receiver};
2870+
Object.defineProperty(e, 'transceiver',
2871+
{value: {receiver: e.receiver}});
28252872
}
28262873
return e;
28272874
});
@@ -3433,35 +3480,6 @@ module.exports = {
34333480
}
34343481
});
34353482
}
3436-
} else {
3437-
// migrate from non-spec RTCIceServer.url to RTCIceServer.urls
3438-
var OrigPeerConnection = window.RTCPeerConnection;
3439-
window.RTCPeerConnection = function(pcConfig, pcConstraints) {
3440-
if (pcConfig && pcConfig.iceServers) {
3441-
var newIceServers = [];
3442-
for (var i = 0; i < pcConfig.iceServers.length; i++) {
3443-
var server = pcConfig.iceServers[i];
3444-
if (!server.hasOwnProperty('urls') &&
3445-
server.hasOwnProperty('url')) {
3446-
utils.deprecated('RTCIceServer.url', 'RTCIceServer.urls');
3447-
server = JSON.parse(JSON.stringify(server));
3448-
server.urls = server.url;
3449-
newIceServers.push(server);
3450-
} else {
3451-
newIceServers.push(pcConfig.iceServers[i]);
3452-
}
3453-
}
3454-
pcConfig.iceServers = newIceServers;
3455-
}
3456-
return new OrigPeerConnection(pcConfig, pcConstraints);
3457-
};
3458-
window.RTCPeerConnection.prototype = OrigPeerConnection.prototype;
3459-
// wrap static methods. Currently just generateCertificate.
3460-
Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', {
3461-
get: function() {
3462-
return OrigPeerConnection.generateCertificate;
3463-
}
3464-
});
34653483
}
34663484

34673485
var origGetStats = window.RTCPeerConnection.prototype.getStats;
@@ -5379,3 +5397,4 @@ module.exports = {
53795397

53805398
},{}]},{},[3])(3)
53815399
});
5400+

0 commit comments

Comments
 (0)