-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
304 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import PlaylistPanel from './PlaylistPanel'; | ||
|
||
export default function PlaylistsPanel(props) { | ||
const { mainPlaylist, audioPlaylist } = props; | ||
|
||
return ( | ||
<Box display="flex" flexDirection="row"> | ||
<Box> | ||
<PlaylistPanel playlist={mainPlaylist} playlistType="Main" /> | ||
</Box> | ||
{audioPlaylist && | ||
<Box> | ||
<PlaylistPanel playlist={audioPlaylist} playlistType="Audio" /> | ||
</Box> | ||
} | ||
</Box> | ||
); | ||
} |
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,50 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Card from '@material-ui/core/Card'; | ||
import CardContent from '@material-ui/core/CardContent'; | ||
import Table from '@material-ui/core/Table'; | ||
import TableBody from '@material-ui/core/TableBody'; | ||
import TableCell from '@material-ui/core/TableCell'; | ||
import TableContainer from '@material-ui/core/TableContainer'; | ||
import TableRow from '@material-ui/core/TableRow'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
hasTimes: { | ||
backgroundColor: theme.palette.success.main | ||
} | ||
})); | ||
|
||
export default function SegmentInfo(props) { | ||
const classes = useStyles(); | ||
const { segment } = props; | ||
|
||
const hasTimes = typeof segment.start === 'number' && typeof segment.end == 'number'; | ||
|
||
return ( | ||
<Card variant="outlined" className={`${hasTimes ? classes.hasTimes : ''}`}> | ||
<CardContent> | ||
<Typography variant="h6"> | ||
{segment.mediaIndex} | ||
{hasTimes && ( | ||
<span> | {segment.start.toFixed(3)} => {segment.end.toFixed(3)}</span> | ||
)} | ||
</Typography> | ||
<TableContainer> | ||
<Table size="small"> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell>duration</TableCell> | ||
<TableCell align="right">{segment.duration.toFixed(3)}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell>timeline</TableCell> | ||
<TableCell align="right">{segment.timeline}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
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,16 @@ | ||
import React from 'react'; | ||
|
||
export default function SegmentRequestInfo(props) { | ||
const { segment } = props; | ||
|
||
// TODO get HAR for segment request if available | ||
chrome.devtools.network.getHAR((result) => { | ||
console.log(result); | ||
}); | ||
|
||
return ( | ||
<div> | ||
<p>Index: {segment.mediaIndex}</p> | ||
</div> | ||
); | ||
} |
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,31 @@ | ||
import React, { useState } from 'react'; | ||
import List from '@material-ui/core/List'; | ||
import ListItem from '@material-ui/core/ListItem'; | ||
import SegmentInfo from './SegmentInfo'; | ||
|
||
export default function SegmentsList(props) { | ||
const { segments, setSegmentSelection } = props; | ||
const [selectedIndex, setSelectedIndex] = useState(null); | ||
|
||
const handleListItemClicked = (index) => { | ||
setSelectedIndex(index); | ||
setSegmentSelection(index); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<List> | ||
{segments.map((segment) => ( | ||
<ListItem | ||
button | ||
selected={selectedIndex === segment.mediaIndex} | ||
onClick={handleListItemClicked.bind(null, segment.mediaIndex)} | ||
key={segment.mediaIndex} | ||
> | ||
<SegmentInfo segment={segment} /> | ||
</ListItem> | ||
))} | ||
</List> | ||
</div> | ||
); | ||
} |
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,58 @@ | ||
import React, { useState } from 'react'; | ||
import SegmentsList from './SegmentsList'; | ||
import SegmentRequestInfo from './SegmentRequestInfo'; | ||
import MenuItem from '@material-ui/core/MenuItem'; | ||
import FormControl from '@material-ui/core/FormControl'; | ||
import Select from '@material-ui/core/Select'; | ||
import InputLabel from '@material-ui/core/InputLabel'; | ||
import Box from '@material-ui/core/Box'; | ||
|
||
export default function SegmentsPanel(props) { | ||
const { player } = props; | ||
const [selectedPlaylistType, setSelectedPlaylistType] = useState('Main'); | ||
const [selectedSegmentIndex, setSelectedSegmentIndex] = useState(null); | ||
|
||
const handlePlaylistSelection = (event) => { | ||
setSelectedPlaylistType(event.target.value); | ||
}; | ||
|
||
const setSegmentSelection = (segmentIndex) => { | ||
setSelectedSegmentIndex(segmentIndex); | ||
}; | ||
|
||
const selectedPlaylist = player[`${selectedPlaylistType.toLowerCase()}Playlist`]; | ||
|
||
return ( | ||
<div> | ||
{player.audioPlaylist && ( | ||
<Box ml={1} mt={1}> | ||
<FormControl> | ||
<InputLabel>Playlist</InputLabel> | ||
<Select | ||
value={selectedPlaylistType} | ||
onChange={handlePlaylistSelection} | ||
> | ||
<MenuItem value='Main'>Main</MenuItem> | ||
<MenuItem value='Audio'>Audio</MenuItem> | ||
</Select> | ||
</FormControl> | ||
</Box> | ||
)} | ||
<Box display="flex" flexDirection="row"> | ||
<Box> | ||
<SegmentsList | ||
segments={selectedPlaylist.segments} | ||
setSegmentSelection={setSegmentSelection} | ||
/> | ||
</Box> | ||
{typeof selectedSegmentIndex === 'number' && ( | ||
<Box> | ||
<SegmentRequestInfo | ||
segment={selectedPlaylist.segments[selectedSegmentIndex]} | ||
/> | ||
</Box> | ||
)} | ||
</Box> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.