👀 Reading hidden code
<z id="player"></z>
<button class="button" id="stopButton">Stop</button>
<script>
const player = document.getElementById('player')
const stop = document.getElementById('stopButton')
const handleSuccess = function(stream) {
const context = new AudioContext()
const source = context.createMediaStreamSource(stream)
const processor = context.createScriptProcessor(1024, 1, 1);
source.connect(processor)
processor.connect(context.destination)
processor.onaudioprocess = function(e) {
const data = e.inputBuffer.getChannelData(0)
player.value = data
player.dispatchEvent(new CustomEvent("input"))
if(!document.body.contains(player)){
processor.onaudioprocess = undefined
}
}
stop.onclick = () => {processor.onaudioprocess = undefined}
}
navigator.mediaDevices.getUserMedia({ audio: true, video: false })
.then(handleSuccess)
</script>
<style>
.button {
background-color: darkred;
border: none;
border-radius: 12px;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: "Alegreya Sans", sans-serif;
margin: 4px 2px;
cursor: pointer;
}
</style>
""")
using Plots
👀 Reading hidden code
Cannot convert Missing to series data for plotting
Here is what happened, the most recent locations are first:
- error
(s::String) from error.jl:33 - _prepare_series_data
(x::Missing) from series.jl:8 - _series_data_vector
(x::Missing, plotattributes::Dict{Symbol, Any}) from series.jl:36 - macro expansionfrom series.jl:129
- apply_recipe
(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any) from RecipesBase.jl:300 - _process_userrecipes!
(plt::Any, plotattributes::Any, args::Any) from user_recipe.jl:38 - recipe_pipeline!
(plt::Any, plotattributes::Any, args::Any) - _plot!
(plt::Plots.Plot, plotattributes::Any, args::Any) from plot.jl:223 - plot
(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}}) from plot.jl:102 - from This cell: line 1
plot(audio*10, ylim=(-1,1))
plot(audio*10, ylim=(-1,1))
👀 Reading hidden code