-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the audio tracks API. Not the UI yet. test url: https://elements-demo-vanilla-git-fork-luwes-audio-tracks-api-mux.vercel.app/mux-player-audio-tracks.html Co-authored-by: Christian Pillsbury <[email protected]>
- Loading branch information
1 parent
f584e94
commit 13bfbdb
Showing
6 changed files
with
115 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
examples/vanilla-ts-esm/public/mux-player-audio-tracks.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title><mux-player> audio tracks example</title> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"> | ||
<link rel="stylesheet" href="./styles.css"> | ||
<script | ||
defer | ||
src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1" | ||
></script> | ||
<script type="module" src="./dist/mux-player.js"></script> | ||
<style> | ||
mux-player { | ||
display: block; | ||
width: 100%; | ||
margin: 1rem 0 2rem; | ||
background-color: #000; | ||
line-height: 0; | ||
} | ||
|
||
mux-player:not([audio]) { | ||
aspect-ratio: 16 / 9; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<header> | ||
<div class="left-header"> | ||
<a class="mux-logo" href="https://www.mux.com/player" target="_blank"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/360826/233653989-11cd8603-c20f-4008-8bf7-dc15b743c52b.svg"> | ||
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/360826/233653583-50dda726-cbe7-4182-a113-059a91ae83e6.svg"> | ||
<img alt="Mux Logo" src="https://user-images.githubusercontent.com/360826/233653583-50dda726-cbe7-4182-a113-059a91ae83e6.svg"> | ||
</picture> | ||
</a> | ||
<h1><a href="/">Elements</a></h1> | ||
</div> | ||
<div class="right-header"> | ||
<a class="github-logo" href="https://github.com/muxinc/elements" target="_blank"> | ||
<img width="32" height="32" src="./images/github-logo.svg" alt="Github logo"> | ||
</a> | ||
</div> | ||
</header> | ||
|
||
<mux-player | ||
id="muxPlayer" | ||
stream-type="on-demand" | ||
src="https://playertest.longtailvideo.com/adaptive/elephants_dream_v4/index.m3u8" | ||
></mux-player> | ||
|
||
<br> | ||
|
||
<select id="audioselect"></select> | ||
|
||
<br> | ||
<br> | ||
|
||
<script type="module"> | ||
|
||
muxPlayer.audioTracks.addEventListener('removetrack', ({ track }) => { | ||
audioselect.querySelector(`[value="${track.id}"]`).remove(); | ||
}); | ||
|
||
muxPlayer.audioTracks.addEventListener('addtrack', ({ track }) => { | ||
audioselect.append(new Option( | ||
track.label, | ||
track.id, | ||
track.enabled, | ||
track.enabled | ||
)); | ||
}); | ||
|
||
audioselect.addEventListener('change', () => { | ||
for (let track of muxPlayer.audioTracks) { | ||
track.enabled = audioselect.value == track.id; | ||
} | ||
}); | ||
</script> | ||
|
||
<a href="../">Browse Elements</a> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13bfbdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
elements-demo-svelte-kit – ./examples/svelte-kit
elements-demo-svelte-kit-git-main-mux.vercel.app
elements-demo-svelte-kit.vercel.app
elements-demo-svelte-kit-mux.vercel.app
13bfbdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
elements-demo-vanilla – ./examples/vanilla-ts-esm
elements-demo-vanilla-mux.vercel.app
elements-demo-vanilla-git-main-mux.vercel.app
elements-demo-vanilla.vercel.app
13bfbdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
elements-demo-vue – ./examples/vue-with-typescript
elements-demo-vue-mux.vercel.app
elements-demo-vue.vercel.app
elements-demo-vue-git-main-mux.vercel.app
13bfbdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
elements-demo-create-react-app – ./examples/create-react-app-with-typescript
elements-demo-create-react-app-git-main-mux.vercel.app
elements-demo-create-react-app-mux.vercel.app
elements-demo-create-react-app.vercel.app
13bfbdb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
elements-demo-nextjs – ./examples/nextjs-with-typescript
elements-demo-nextjs-mux.vercel.app
elements-demo-nextjs-git-main-mux.vercel.app
elements-demo-nextjs.vercel.app