Skip to content

Commit

Permalink
Fix broken components
Browse files Browse the repository at this point in the history
  • Loading branch information
bb-face committed May 28, 2024
1 parent 536b639 commit 6c68425
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 35 deletions.
1 change: 1 addition & 0 deletions gateway/src/components/Broadcast/ApiKey.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react";
import { useStore } from "./state";

import styled from "styled-components";

const FormContainer = styled.form`
display: flex;
flex-direction: column;
Expand Down
2 changes: 2 additions & 0 deletions gateway/src/components/Broadcast/GenerateStream.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { useState } from "react";
import styled from "styled-components";

import { useStore } from "./state";

const GenerateStream = ({ url }) => {
Expand Down
30 changes: 6 additions & 24 deletions gateway/src/components/Broadcast/WatchStream.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useState } from "react";
import { useStore } from "../Broadcast/state";
import React from "react";
import styled from "styled-components";

import { useStore } from "../Broadcast/state";

const Container = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -56,30 +58,10 @@ const WatchStream = ({ pId }) => {

return (
<Container>
<Form onSubmit={createStream}>
<Input
type="text"
value={streamName}
onChange={(event) => setStreamName(event.target.value)}
placeholder="Enter stream name"
/>
<Button type="submit">Create Stream</Button>
</Form>
<Form onSubmit={handleSubmit}>
<Input
type="text"
value={inputValue}
onChange={handleChange}
placeholder="Enter playbackId to watch"
/>
<p>Current Input: {inputValue}</p>
<Button type="submit">Watch Stream</Button>
</Form>
{streamLink && (
{currentPlaybackId && (
<IframeContainer>
{" "}
<iframe
src={`https://lvpr.tv?v=${streamLink}`}
src={`https://lvpr.tv?v=${currentPlaybackId}`}
frameborder="0"
allowfullscreen
allow="autoplay; encrypted-media; picture-in-picture"
Expand Down
52 changes: 41 additions & 11 deletions widget/page/home.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
const Container = styled.div`
display: flex;
flex-direction: column;
color: white;
justify-content: center;
align-items: center;
`;

const StlyedInput = styled.input`
color: black;
padding: 4px;
`;

const Dropdown = styled.select`
ping: 10px;
margin: 20px 0;
border: 1px solid #ccc;
border-radius: 4px;
color: black;
`;

const OptionComponent = styled.div`
padding: 20px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f9f9f9;
width: 80%;
text-align: center;
display: flex;
Expand Down Expand Up @@ -61,6 +73,24 @@ const broadcastApiKeyCode = `
\`\`\`
`;

const broadcastLocalCode = `
\`\`\`js
<Broadcast.GenerateStream url={url} />
<Broadcast.Player />
<Broadcast.WatchStream pId={pId} />
\`\`\`
`;

const broadcastRemoteCode = `
\`\`\`js
<Broadcast.GenerateStream
url={"https://livepeer-webserver-613b208ef083.herokuapp.com"}
/>
<Broadcast.Player />
<Broadcast.WatchStream pId={pId} />
\`\`\`
`;

const Option1 = () => (
<OptionComponent>
Api key
Expand Down Expand Up @@ -111,7 +141,7 @@ const Option3 = ({ showVideo, handleClick }) => {
);
};

const Option1Broadcast = ({ pId }) => {
const Option1Broadcast = () => {
return (
<>
Set api key and start a stream!
Expand All @@ -127,7 +157,7 @@ const Option2Broadcast = ({ url, pId }) => {
return (
<>
Set api key and start a stream!
<Markdown text={broadcastApiKeyCode} />
<Markdown text={broadcastLocalCode} />
<Broadcast.GenerateStream url={url} />
<Broadcast.Player />
Or you can insert a playbackId and watch a stream:
Expand All @@ -140,7 +170,7 @@ const Option3Broadcast = ({ pId }) => {
return (
<>
Set api key and start a stream!
<Markdown text={broadcastApiKeyCode} />
<Markdown text={broadcastRemoteCode} />
<Broadcast.GenerateStream
url={"https://livepeer-webserver-613b208ef083.herokuapp.com"}
/>
Expand Down Expand Up @@ -169,7 +199,7 @@ function resetUrl() {
}

return (
<div className="container">
<Container>
Select which component you want to check:
<Dropdown
value={selectedComponent}
Expand All @@ -194,7 +224,7 @@ return (
<>
{!inputSet ? (
<div>
<input
<StlyedInput
type="text"
onChange={(event) => setUrl(event.target.value)}
value={url}
Expand Down Expand Up @@ -222,14 +252,14 @@ return (
<>
{!inputSet ? (
<div>
<input
<StlyedInput
type="text"
onChange={(event) => setUrl(event.target.value)}
value={url}
/>
<button onClick={() => setInputSet(true)}>Set url</button>
Provide a playbackId if you wanna watch a stream:
<input
<StlyedInput
type="text"
onChange={(event) => setPid(event.target.value)}
value={pId}
Expand All @@ -248,7 +278,7 @@ return (
<>
<div>
Provide a playbackId if you wanna watch a stream:
<input
<StlyedInput
type="text"
onChange={(event) => setPid(event.target.value)}
value={pId}
Expand All @@ -259,5 +289,5 @@ return (
)}
</>
)}
</div>
</Container>
);

0 comments on commit 6c68425

Please sign in to comment.