Skip to content

Commit

Permalink
add youtube src to default examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Nov 24, 2023
1 parent 758ab5a commit 1004c2c
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions player/react/default-layout/src/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export function Player() {
case 'hls':
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
break;
case 'youtube':
setSrc('youtube/_cMxraX_5RE');
break;
}
}

Expand Down Expand Up @@ -102,6 +105,7 @@ export function Player() {
<button onClick={() => changeSource('audio')}>Audio</button>
<button onClick={() => changeSource('video')}>Video</button>
<button onClick={() => changeSource('hls')}>HLS</button>
<button onClick={() => changeSource('youtube')}>YouTube</button>
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions player/react/default-theme/src/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export function Player() {
case 'hls':
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
break;
case 'youtube':
setSrc('youtube/_cMxraX_5RE');
break;
}
}

Expand Down Expand Up @@ -105,6 +108,7 @@ export function Player() {
<button onClick={() => changeSource('audio')}>Audio</button>
<button onClick={() => changeSource('video')}>Video</button>
<button onClick={() => changeSource('hls')}>HLS</button>
<button onClick={() => changeSource('youtube')}>YouTube</button>
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions player/solid/default-layout/src/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export function Player() {
case 'hls':
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
break;
case 'youtube':
setSrc('youtube/_cMxraX_5RE');
break;
}
}

Expand Down Expand Up @@ -100,6 +103,7 @@ export function Player() {
<button onClick={() => changeSource('audio')}>Audio</button>
<button onClick={() => changeSource('video')}>Video</button>
<button onClick={() => changeSource('hls')}>HLS</button>
<button onClick={() => changeSource('youtube')}>YouTube</button>
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions player/solid/default-theme/src/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export function Player() {
case 'hls':
setSrc(`https://stream.mux.com/${muxPlaybackId}.m3u8`);
break;
case 'youtube':
setSrc('youtube/_cMxraX_5RE');
break;
}
}

Expand Down Expand Up @@ -115,6 +118,7 @@ export function Player() {
<button onClick={() => changeSource('audio')}>Audio</button>
<button onClick={() => changeSource('video')}>Video</button>
<button onClick={() => changeSource('hls')}>HLS</button>
<button onClick={() => changeSource('youtube')}>YouTube</button>
</div>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions player/svelte/default-layout/src/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
case 'hls':
src = `https://stream.mux.com/${muxPlaybackId}.m3u8`;
break;
case 'youtube':
src = 'youtube/_cMxraX_5RE';
break;
}
}
</script>
Expand Down Expand Up @@ -98,6 +101,7 @@
<button on:click={() => changeSource('audio')}>Audio</button>
<button on:click={() => changeSource('video')}>Video</button>
<button on:click={() => changeSource('hls')}>HLS</button>
<button on:click={() => changeSource('youtube')}>YouTube</button>
</div>

<style lang="postcss">
Expand Down
4 changes: 4 additions & 0 deletions player/svelte/default-theme/src/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
case 'hls':
src = `https://stream.mux.com/${muxPlaybackId}.m3u8`;
break;
case 'youtube':
src = 'youtube/_cMxraX_5RE';
break;
}
}
</script>
Expand Down Expand Up @@ -108,6 +111,7 @@
<button on:click={() => changeSource('audio')}>Audio</button>
<button on:click={() => changeSource('video')}>Video</button>
<button on:click={() => changeSource('hls')}>HLS</button>
<button on:click={() => changeSource('youtube')}>YouTube</button>
</div>

<style lang="postcss">
Expand Down
4 changes: 4 additions & 0 deletions player/vue/default-layout/src/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ function changeSource(type: string) {
case 'hls':
$src.value = `https://stream.mux.com/${muxPlaybackId}.m3u8`;
break;
case 'youtube':
$src.value = 'youtube/_cMxraX_5RE';
break;
}
}
</script>
Expand Down Expand Up @@ -99,6 +102,7 @@ function changeSource(type: string) {
<button @click="changeSource('audio')">Audio</button>
<button @click="changeSource('video')">Video</button>
<button @click="changeSource('hls')">HLS</button>
<button @click="changeSource('youtube')">YouTube</button>
</div>
</template>

Expand Down
4 changes: 4 additions & 0 deletions player/vue/default-theme/src/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ function changeSource(type: string) {
case 'hls':
$src.value = `https://stream.mux.com/${muxPlaybackId}.m3u8`;
break;
case 'youtube':
$src.value = 'youtube/_cMxraX_5RE';
break;
}
}
</script>
Expand Down Expand Up @@ -108,6 +111,7 @@ function changeSource(type: string) {
<button @click="changeSource('audio')">Audio</button>
<button @click="changeSource('video')">Video</button>
<button @click="changeSource('hls')">HLS</button>
<button @click="changeSource('youtube')">YouTube</button>
</div>
</template>

Expand Down
1 change: 1 addition & 0 deletions player/web-components/default-layout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<button id="audio-src-button">Audio</button>
<button id="video-src-button">Video</button>
<button id="hls-src-button">HLS</button>
<button id="yt-src-button">YouTube</button>
</div>
</main>
</body>
Expand Down
7 changes: 6 additions & 1 deletion player/web-components/default-layout/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ player.addEventListener('can-play', () => {

const audioSrcButton = document.querySelector('#audio-src-button'),
videoSrcButton = document.querySelector('#video-src-button'),
hlsSrcButton = document.querySelector('#hls-src-button');
hlsSrcButton = document.querySelector('#hls-src-button'),
ytSrcButton = document.querySelector('#yt-src-button');

audioSrcButton?.addEventListener('click', () => changeSource('audio'));
videoSrcButton?.addEventListener('click', () => changeSource('video'));
hlsSrcButton?.addEventListener('click', () => changeSource('hls'));
ytSrcButton?.addEventListener('click', () => changeSource('youtube'));

changeSource('audio');

Expand All @@ -48,6 +50,9 @@ function changeSource(type: string) {
case 'hls':
player.src = `https://stream.mux.com/${muxPlaybackId}.m3u8`;
break;
case 'youtube':
player.src = 'youtube/_cMxraX_5RE';
break;
}
}

Expand Down

0 comments on commit 1004c2c

Please sign in to comment.