Comments (11)
@SangwonOh, thank you for checking up on me. Yes, I have managed to find a solution.
from ovenlivekit-web.
I guess that its not streaming at the point you call getAudioTracks so you need to check that it returns something before calling the enable function.
from ovenlivekit-web.
@IanMitchell77 , thanks again for helping me out!
As soon as the page loads, the microphone is accessed, and a little red dot indicator at the top of the page, where the page tab is, appears.
Plus, the console returns "OvenLiveKit.js : Received Media Stream From Input Device", with MediaStream {id, ...}
To my understanding, this means that the audio is streaming.
Here is the page code for reference; this is the latest version, as is (I have tried accessing the audio stream with MediaStream.getAudioTracks[0], but the result is the same):
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body class="text-center body-centered">
<main class="form-centered">
<form>
<div class="form-floating mb-4">
<input type="button" class="button-publish" id="muteBtn" value="GO LIVE">
</div>
</form>
</main>
<!-- Voice capture script -->
<script src="https://cdn.jsdelivr.net/npm/ovenlivekit@latest/dist/OvenLiveKit.min.js"></script><script defer="defer" src="fda0b8224f3acb87a87b.bundle.js"></script>
<script>
// Initialize OvenLiveKit
let ovenLivekit = OvenLiveKit.create();
// Get media stream from user device
ovenLivekit.getUserMedia({video: false, audio: true}).then(function () {
// Got device stream and start streaming to OvenMediaEngine
ovenLivekit.startStreaming('wss://your_oven_media_engine:3333/app/stream?direction=send');
});
document.getElementById("muteBtn").onclick = function(evt) {
const newState = !MediaStream.getAudioTracks[0].enabled;
document.getElementById("muteBtn").innerHTML = newState ? "▶️" : "⏸️";
MediaStream.getAudioTracks[0].enabled = newState;
}
</script>
<!-- Bootstrap script -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body></html>
from ovenlivekit-web.
hang on! MediaStream isnt anything - maybe it should be ovenLivekit?
from ovenlivekit-web.
Try printing the contents of MediaStream, and MediaStream.getAudioTracks[0]
from ovenlivekit-web.
Running console.log(ovenLiveKit.stream);
This returns MediaStream {...}, but when trying to access getAudioTracks, the console logging returns "undefined".
from ovenlivekit-web.
from ovenlivekit-web.
You want to check that the length is not 0 - I guess you need to add the track first but I dont know anything about OvenLiveKit to be honest.
from ovenlivekit-web.
Thank you, @IanMitchell77 for your input, definitely, appreciate it!
from ovenlivekit-web.
@dprisikar Hi. Is your problem solved?
from ovenlivekit-web.
@SangwonOh, thank you for checking up on me. Yes, I have managed to find a solution.
Hi, what was your solution? (I'm having a similar issue)
from ovenlivekit-web.
Related Issues (15)
- Delay in Start the Streaming of Screen Share HOT 3
- Screen sharing? HOT 5
- Deprecated
- Is it possible to set the maximum framerate? HOT 1
- Support for Attaching External MediaStreams
- Taking 30-40 sec to load input devices list in ionic android HOT 1
- Help with WebRTC Steaming - Mirror Input Horizontally HOT 2
- Critical issue on iOS 15.1 HOT 9
- Problem with getDevices function HOT 2
- connectionClosed callback doesn't work if stream is stopped from client side HOT 5
- Webrtc push stream minimum bit rate HOT 1
- Can't get 720x1280 stream from webcam HOT 10
- How I can enable/disable the microphone/camera without restarting the stream? HOT 1
- Can push screen to OME like getDisplayMedia() using OvenLiveKit? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ovenlivekit-web.