-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dgw): support for .cast files that have two slices with the same …
…timestamp in recording player (#1054) In some cases, two slices may have the same timestamp. Previously this caused errors.
- Loading branch information
1 parent
7fb1dfe
commit 8ed5163
Showing
11 changed files
with
2,204 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function ensureNoSameTimeCues(content) { | ||
const lines = content.split('\n'); | ||
let prevLine = null; // Correctly using let to track previous line | ||
for (let i = 0; i < lines.length; i++) { | ||
const line = lines[i]; | ||
try { | ||
const parsed = JSON.parse(line); | ||
if (Array.isArray(parsed)) { | ||
if (prevLine && prevLine[0] === parsed[0]) { | ||
parsed[0] += 0.001; // Adjust timestamp if same as previous | ||
} | ||
// Update the current line in the array after modification | ||
lines[i] = JSON.stringify(parsed); | ||
prevLine = parsed; // Update prevLine to the current parsed line | ||
} | ||
} catch (e) { | ||
// If parsing fails (e.g., it's a non-JSON line), skip or handle error | ||
} | ||
} | ||
return lines.join('\n'); | ||
} |
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,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,133 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Recording Player Tester</title> | ||
|
||
</head> | ||
|
||
<body> | ||
<div id="app"> | ||
<h1>Recording Player Tester</h1> | ||
<p>Please upload your recording file (.trp, .webm, .cast):</p> | ||
<input type="file" id="fileInput" accept=".trp,.webm,.cast" /> | ||
<div id="fileDetails"></div> | ||
<button class="btn" id="playButton">Play</button> | ||
</div> | ||
<div id="player" style="display: none;"> | ||
<button id="closePlayer" >close </button> | ||
<div id="frameWrapper"></div> | ||
</div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: #f5f5f5; | ||
} | ||
|
||
#app { | ||
text-align: center; | ||
background-color: #fff; | ||
padding: 2rem; | ||
border-radius: 10px; | ||
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); | ||
max-width: 400px; | ||
width: 100%; | ||
} | ||
|
||
h1 { | ||
font-size: 1.5rem; | ||
color: #333; | ||
margin-bottom: 1.5rem; | ||
} | ||
|
||
input[type="file"] { | ||
padding: 0.5rem; | ||
margin-top: 1rem; | ||
cursor: pointer; | ||
} | ||
|
||
#fileDetails { | ||
margin-top: 1.5rem; | ||
font-size: 0.9rem; | ||
color: #555; | ||
} | ||
|
||
#fileDetails p { | ||
margin: 0.5rem 0; | ||
} | ||
|
||
.error { | ||
color: red; | ||
font-weight: bold; | ||
} | ||
|
||
.btn { | ||
margin-top: 2rem; | ||
padding: 0.75rem 1.5rem; | ||
background-color: #007bff; | ||
color: #fff; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
font-size: 1rem; | ||
} | ||
|
||
.btn:disabled { | ||
background-color: #cccccc; | ||
cursor: not-allowed; | ||
} | ||
|
||
#player { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
display: none; | ||
justify-content: center; | ||
align-items: center; | ||
margin-top: 2rem; | ||
height: 100vh; | ||
width: 100vw; | ||
overflow: hidden; | ||
} | ||
|
||
.iframeContent { | ||
position: relative; | ||
height: 50vh; | ||
width: 50vw; | ||
border: none; | ||
overflow: hidden; | ||
} | ||
|
||
.col-actions { | ||
width: 80px; | ||
} | ||
|
||
.date-selector-button { | ||
margin: 0; | ||
margin-top: 4px; | ||
margin-right: 14px; | ||
} | ||
|
||
.full-page-table.p-datatable { | ||
height: 100%; | ||
} | ||
|
||
#closePlayer{ | ||
position: absolute; | ||
top: 100px; | ||
right: 400px; | ||
} | ||
</style> | ||
|
||
</html> |
Oops, something went wrong.