Spaces:
Build error
Build error
Youngsun Lim commited on
Commit Β·
2e13497
1
Parent(s): d521b9d
no sound videos2
Browse files
app.py
CHANGED
|
@@ -369,6 +369,40 @@ html, body, .gradio-container { background: transparent !important; }
|
|
| 369 |
|
| 370 |
# -------------------- UI --------------------
|
| 371 |
with gr.Blocks(fill_height=True, css=GLOBAL_CSS) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
order_state = gr.State(value=[]) # v4μμλ value= κΆμ₯
|
| 373 |
ptr_state = gr.State(value=0)
|
| 374 |
cur_video_id = gr.State(value="")
|
|
|
|
| 369 |
|
| 370 |
# -------------------- UI --------------------
|
| 371 |
with gr.Blocks(fill_height=True, css=GLOBAL_CSS) as demo:
|
| 372 |
+
# Blocks μ, μ΄λμλ ν λ²λ§ μΆκ°(κΆμ₯ μμΉ: Blocks μμ μ§ν)
|
| 373 |
+
gr.HTML("""
|
| 374 |
+
<script>
|
| 375 |
+
(function(){
|
| 376 |
+
function muteAll(root){
|
| 377 |
+
const vids = (root || document).querySelectorAll('video');
|
| 378 |
+
vids.forEach(v => {
|
| 379 |
+
try {
|
| 380 |
+
v.muted = true;
|
| 381 |
+
v.volume = 0.0;
|
| 382 |
+
v.setAttribute('muted','');
|
| 383 |
+
// μ¬μ©μκ° μ€μλ‘ ν€λλΌλ λ€μ 0μΌλ‘
|
| 384 |
+
v.addEventListener('volumechange', () => {
|
| 385 |
+
if (!v.muted || v.volume > 0) { v.muted = true; v.volume = 0.0; }
|
| 386 |
+
});
|
| 387 |
+
} catch(e){}
|
| 388 |
+
});
|
| 389 |
+
}
|
| 390 |
+
// μ΄κΈ° λ λμμ μμκ±°
|
| 391 |
+
muteAll(document);
|
| 392 |
+
// μ΄ν λμ μμ±λλ λΉλμ€λ κ°μν΄μ μμκ±°
|
| 393 |
+
const obs = new MutationObserver(muts => {
|
| 394 |
+
for (const m of muts) {
|
| 395 |
+
if (m.type === 'childList') {
|
| 396 |
+
muteAll(m.target);
|
| 397 |
+
m.addedNodes && m.addedNodes.forEach(n => muteAll(n));
|
| 398 |
+
}
|
| 399 |
+
}
|
| 400 |
+
});
|
| 401 |
+
obs.observe(document.body, {subtree:true, childList:true});
|
| 402 |
+
})();
|
| 403 |
+
</script>
|
| 404 |
+
""")
|
| 405 |
+
|
| 406 |
order_state = gr.State(value=[]) # v4μμλ value= κΆμ₯
|
| 407 |
ptr_state = gr.State(value=0)
|
| 408 |
cur_video_id = gr.State(value="")
|