Revision 70e8fc9c

View differences:

html/janus.js
1498 1498
							streamsDone(handleId, jsep, media, callbacks, stream);
1499 1499
						}
1500 1500
					};
1501
					function getScreenMedia(constraints, gsmCallback) {
1501
					function getScreenMedia(constraints, gsmCallback, useAudio) {
1502 1502
						Janus.log("Adding media constraint (screen capture)");
1503 1503
						Janus.debug(constraints);
1504 1504
						navigator.mediaDevices.getUserMedia(constraints)
1505
							.then(function(stream) { gsmCallback(null, stream); })
1505
							.then(function(stream) { 
1506
								if(useAudio){
1507
									navigator.mediaDevices.getUserMedia({ audio: true })
1508
									.then(function (audioStream) {
1509
										stream.addTrack(audioStream.getAudioTracks()[0]);
1510
										gsmCallback(null, stream);
1511
									})
1512
								} else {
1513
									gsmCallback(null, stream);
1514
								} 
1515
							})
1506 1516
							.catch(function(error) { pluginHandle.consentDialog(false); gsmCallback(error); });
1507 1517
					};
1508 1518
					if(adapter.browserDetails.browser === 'chrome') {
......
1593 1603
								callbacks.error(error);
1594 1604
							} else {
1595 1605
								constraints = {
1596
									audio: isAudioSendEnabled(media),
1606
									audio: false,
1597 1607
									video: {
1598 1608
										mandatory: {
1599 1609
											chromeMediaSource: 'desktop',
......
1609 1619
									}
1610 1620
								};
1611 1621
								constraints.video.mandatory.chromeMediaSourceId = event.data.sourceId;
1612
								getScreenMedia(constraints, callback);
1622
								getScreenMedia(constraints, callback, isAudioSendEnabled(media));
1613 1623
							}
1614 1624
						} else if (event.data.type == 'janusGetScreenPending') {
1615 1625
							window.clearTimeout(event.data.id);
html/janus.nojquery.js
1550 1550
							streamsDone(handleId, jsep, media, callbacks, stream);
1551 1551
						}
1552 1552
					};
1553
					function getScreenMedia(constraints, gsmCallback) {
1553
					function getScreenMedia(constraints, gsmCallback, useAudio) {
1554 1554
						Janus.log("Adding media constraint (screen capture)");
1555 1555
						Janus.debug(constraints);
1556 1556
						navigator.mediaDevices.getUserMedia(constraints)
1557
							.then(function(stream) { gsmCallback(null, stream); })
1557
							.then(function(stream) { 
1558
								if(useAudio){
1559
									navigator.mediaDevices.getUserMedia({ audio: true })
1560
									.then(function (audioStream) {
1561
										stream.addTrack(audioStream.getAudioTracks()[0]);
1562
										gsmCallback(null, stream);
1563
									})
1564
								} else {
1565
									gsmCallback(null, stream);
1566
								} 
1567
							 })
1558 1568
							.catch(function(error) { pluginHandle.consentDialog(false); gsmCallback(error); });
1559 1569
					};
1560 1570
					if(adapter.browserDetails.browser === 'chrome') {
......
1645 1655
								callbacks.error(error);
1646 1656
							} else {
1647 1657
								constraints = {
1648
									audio: isAudioSendEnabled(media),
1658
									audio: false,
1649 1659
									video: {
1650 1660
										mandatory: {
1651 1661
											chromeMediaSource: 'desktop',
......
1661 1671
									}
1662 1672
								};
1663 1673
								constraints.video.mandatory.chromeMediaSourceId = event.data.sourceId;
1664
								getScreenMedia(constraints, callback);
1674
								getScreenMedia(constraints, callback, isAudioSendEnabled(media));
1665 1675
							}
1666 1676
						} else if (event.data.type == 'janusGetScreenPending') {
1667 1677
							window.clearTimeout(event.data.id);
html/screensharingtest.js
161 161
												Janus.debug("Negotiating WebRTC stream for our screen (capture " + capture + ")");
162 162
												screentest.createOffer(
163 163
													{
164
														media: { video: capture, audio: false, videoRecv: false},	// Screen sharing doesn't work with audio, and Publishers are sendonly
164
														media: { video: capture, audioSend: true, videoRecv: false},	// Screen sharing Publishers are sendonly
165 165
														success: function(jsep) {
166 166
															Janus.debug("Got publisher SDP!");
167 167
															Janus.debug(jsep);

Also available in: Unified diff