Skip to content

Commit 7a23bb1

Browse files
authored
Fix autoplay and settings button contrast (#20)
* Remove autoplay and play manually on connection * Fix cog background
1 parent d167b98 commit 7a23bb1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

assets/player.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function createPlayerHook(iceServers = []) {
2424
async connect(view) {
2525
view.el.srcObject = undefined;
2626
view.pc = new RTCPeerConnection({ iceServers: iceServers });
27+
view.el.play();
2728

2829
view.pc.onicecandidate = (ev) => {
2930
view.pushEventTo(view.el, "ice", JSON.stringify(ev.candidate));
@@ -41,6 +42,6 @@ export function createPlayerHook(iceServers = []) {
4142
await view.pc.setLocalDescription(offer);
4243

4344
view.pushEventTo(view.el, "offer", offer);
44-
}
45+
},
4546
};
4647
}

lib/live_ex_webrtc/player.ex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ defmodule LiveExWebRTC.Player do
231231
phx-hook="Player"
232232
class={["w-full h-full", @video_class]}
233233
controls
234-
autoplay
235234
muted
236235
>
237236
</video>
@@ -269,7 +268,7 @@ defmodule LiveExWebRTC.Player do
269268
270269
<button
271270
phx-click="toggle-settings"
272-
class="absolute top-6 left-6 duration-300 ease-in-out group-hover:visible invisible transition-opacity opacity-0 group-hover:opacity-100 rounded-lg hover:bg-stone-800 p-2"
271+
class="absolute top-6 left-6 duration-300 ease-in-out group-hover:visible invisible transition-opacity opacity-0 group-hover:opacity-100 rounded-lg bg-stone-700 hover:bg-stone-800 p-2"
273272
>
274273
<span class="hero-cog-8-tooth text-white w-6 h-6 block" />
275274
</button>
@@ -337,7 +336,7 @@ defmodule LiveExWebRTC.Player do
337336
@impl true
338337
def handle_info(
339338
{:ex_webrtc, pc, {:connection_state_change, :failed}},
340-
%{assigns: %{player: %{pc: pc}}}
339+
%{assigns: %{player: %{pc: pc}}}
341340
) do
342341
exit(:pc_failed)
343342
end

0 commit comments

Comments
 (0)