Skip to content

Commit

Permalink
chore: 🔥delete commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Banou26 committed Feb 17, 2024
1 parent 7e76d3a commit 382faac
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 81 deletions.
15 changes: 1 addition & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,8 @@ export const makeTransmuxer = async ({
}
return workerDestroy()
},
read: () =>{
// console.log('read')
return workerRead()
},
read: () => workerRead(),
seek: (time: number) => workerSeek(Math.max(0, time) * 1000),
// seek: (time: number) => {
// console.log('seek', streamResultPromiseReject)
// if (streamResultPromiseReject) {
// console.log('cancel seek')
// streamResultPromiseReject(new Error('Seeking to a new position.'))
// reader?.cancel()
// console.log('cancelled seek')
// }
// return workerSeek(Math.max(0, time) * 1000)
// },
getInfo: () => getInfo() as Promise<{ input: MediaInfo, output: MediaInfo }>

Check failure on line 207 in src/index.ts

View workflow job for this annotation

GitHub Actions / build

Conversion of type '{ input: { formatName: string; mimeType: string; duration: number; video_mime_type: string; audio_mime_type: string; }; output: { formatName: string; mimeType: string; duration: number; video_mime_type: string; audio_mime_type: string; }; }' to type 'Promise<{ input: MediaInfo; output: MediaInfo; }>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.

Check failure on line 207 in src/index.ts

View workflow job for this annotation

GitHub Actions / build

Conversion of type '{ input: { formatName: string; mimeType: string; duration: number; video_mime_type: string; audio_mime_type: string; }; output: { formatName: string; mimeType: string; duration: number; video_mime_type: string; audio_mime_type: string; }; }' to type 'Promise<{ input: MediaInfo; output: MediaInfo; }>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
}

Expand Down
63 changes: 0 additions & 63 deletions src/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ fetch(VIDEO_URL, { headers: { Range: `bytes=0-1` } })
bufferSize: BUFFER_SIZE,
length: contentLength,
getStream: async (offset, size) => {
// console.log('get stream', offset, size, slow)
if (slow && size !== BUFFER_SIZE) {
await new Promise(resolve => setTimeout(resolve, 5000))
}
Expand Down Expand Up @@ -130,41 +129,6 @@ fetch(VIDEO_URL, { headers: { Range: `bytes=0-1` } })
const video = document.createElement('video')
video.width = 1440

const allVideoEvents = [
'abort',
'canplay',
'canplaythrough',
'durationchange',
'emptied',
'encrypted',
'ended',
'error',
'interruptbegin',
'interruptend',
'loadeddata',
'loadedmetadata',
'loadstart',
'mozaudioavailable',
'pause',
'play',
'playing',
'progress',
'ratechange',
'seeked',
'seeking',
'stalled',
'suspend',
// 'timeupdate',
'volumechange',
'waiting'
]

// for (const event of allVideoEvents) {
// video.addEventListener(event, ev => {
// console.log('video event', event, ev)
// })
// }

const seconds = document.createElement('div')
video.controls = true
video.volume = 0
Expand Down Expand Up @@ -344,38 +308,11 @@ fetch(VIDEO_URL, { headers: { Range: `bytes=0-1` } })
seconds.textContent = video.currentTime.toString()
}, 100)

// setInterval(async () => {
// console.log('time ranges', getTimeRanges(), chunks)
// }, 1000)

setTimeout(async () => {
// await video.pause()
// video.currentTime = 587.618314
// await new Promise(resolve => setTimeout(resolve, 500))
// video.playbackRate = 5

// video.pause()

// console.log('START SLOW SEEK')
slow = true
video.currentTime = 400
// console.log('SLOW SEEK STARTED')
await new Promise(resolve => setTimeout(resolve, 1000))
slow = false
// console.log('START END SEEK')
video.currentTime = 300
// console.log('END SEEK STARTED')


// await new Promise(resolve => setTimeout(resolve, 1000))
// video.currentTime = 500
// await new Promise(resolve => setTimeout(resolve, 1000))
// video.currentTime = 600
// await new Promise(resolve => setTimeout(resolve, 1000))
// video.currentTime = 300
// await new Promise(resolve => setTimeout(resolve, 1000))
// video.currentTime = 534.953306
// await new Promise(resolve => setTimeout(resolve, 1000))
// video.currentTime = 100
}, 2_000)
})
4 changes: 0 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,10 @@ export const toStreamChunkSize = (SIZE: number) => (stream: ReadableStream) =>
this.reader = stream.getReader()
},
async pull(controller) {
// console.log('pull', this.reader, this.leftOverData?.byteLength)
const { leftOverData }: { leftOverData: Uint8Array | undefined } = this

const accumulate = async ({ buffer = new Uint8Array(SIZE), currentSize = 0 } = {}): Promise<{ buffer?: Uint8Array, currentSize?: number, done: boolean }> => {
// console.log('accumulate')
const { value: newBuffer, done } = await this.reader!.read()
// console.log('accumulate2', newBuffer, done)

if (currentSize === 0 && leftOverData) {
buffer.set(leftOverData)
currentSize += leftOverData.byteLength
Expand Down

0 comments on commit 382faac

Please sign in to comment.