-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
question! #8
Comments
Hi.
Can you create a plnkr https://plnkr.co to demonstrate? Note that The result depends on the method chosen to achieve the output of "without any kind of interruptions" and the browser used. Using Have you tried running the code in the branches in this repository in the environments where the video is expected to be rendered? Are there any restrictions on how the output is derived which renders the video to the user in the browser?
Yes, the requirement is possible. If the video can be played at HTML |
I didn't notice the repository had branches, but I saw your code all over the place in stack overflow and also github comments. I tried to use timestampOffset before but it seems I have been making some sort of mistake because it didnt work. Looking at how you used it and replicating it made it work! Made a simple plnkr to demonstrate the approach working https://plnkr.co/edit/DGffcP Feel free to include it in the repository if you wish. (btw I suggest to use folders on the same repository to make it more discoverable, because branches are a bit hidden[maybe this is just me that dont pay much attention to branches]). Thanks a lot for the hint on how to use timestampOffset. Take care! ♥ |
@titoBouzout A slightly modified version of the code https://plnkr.co/edit/28tA98JZJMA1yL6ssrFg?p=preview. Note Updated this repository to include Branches of this repository at each branch. If the code is working as intended this issue can be closed, correct? |
Yes, thanks again. The update is looking good! :) |
Hi again, well, I'm still having problems with this, been reading for hours. 1 -- SourceBuffer.timestampOffset will fail to update if the last blob fed does not contain a complete segment** It seems that trying to update The problem seems to be that when fetching blobs via
So internally (thing that isn't exposed) the 2. -- I was trying to figure out how to get segments from So tried to get a "complete" video using 3. -- if 4. -- My original problem so you understand why Im on this situation. File headers? Im recording a stream with |
Why is using
Can you create a plnkr https://plnkr.co to demonstrate?
What specification are you referring to relevant to "complete segment"? If
Not certain what you mean by "waiting for more blobs"? At the code in mater branch of this repository
Again, what do you specifically mean by "full segment"?
Not certain what you mean by "file headers"? Note that Chromium/Chrome implementation of
Why is using
with If using |
@titoBouzout At which browser are you trying the code? |
@titoBouzout Note, the code at master branch of this repository outputs the expected result at Firefox, not at Chromium. Re A version of the code at master using To merge input tracks into a single video would suggest utilizing Trying to compose code for |
@titoBouzout Perhaps composing code for |
Thanks. I will try to explain, for the sake of simplicity I left out irrelevant code. streamer.js -- So this page gets a stream and records it. This page never dies, the stream is infinite. // streamer.js
var recorder = new MediaRecorder(stream)
recorder.ondataavailable = function(e) {
if (e.data.size > 0) {
send_data_to_client_as_arraybuffer(e.data)
}
}
recorder.start(1000) client.js -- So this page receives the blobs from streamer.js and plays it. There could be as many client.js as you need. // client.js
var media_source = new MediaSource()
media_source.onsourceopen = function (event) {
var source_buffer = media_source.addSourceBuffer('video/webm;codecs=vp9')
window.on_data_from_streamer = function(arraybuffer) {
if (source_buffer.updating === false) {
source_buffer.appendBuffer(new Uint8Array(arraybuffer))
}
}
}
var video = document.createElement('video')
video.src = URL.createObjectURL(media_source) This code just works in a perfect world. So what's the problem with it?
Why? Because:
You can't just feed source_buffer.appendBuffer with blobs from the middle of a stream, it will not work. I know I could just start a new parallel stream.js to serve the client that joined, but my bandwidth will not scale, I can't afford it. I also know about the canvas hack, I need a real solution. Something I tried:
Problems with this:
I didnt try WebRTC, how does WebRTC solve my problem? |
You can get the duration of a video with something like this, which IDK if performs better or worse than using ts-ebml const media = document.createElement('video')
media.preload = 'metadata'
media.currentTime = 24 * 60 * 60 // ridiculous high
media.ondurationchange = function() {
if (media.duration != Infinity) {
console.log(media.duration)
media.ondurationchange = null
}
}
media.src = URL.createObjectURL(blob) |
Before proceeding, can you kindly answer the questions presented above
Why is
Again, why is
You can if
Not sure what you mean by "canvas hack"? Using
Have you read the previous comment described the specified procedure that Would, again, suggest to try each branch of this repository in the browser(s) that you are targeting. This is an example of code that is similar to what is described. The video is streamed from a JavaScript Module to a different HTML |
Yes, am familiar with that approach to get the When you run the code at the linked plnkr from the previous comment, the media stream is being exported to the parent document. Any number of videos can be streamed by continuing to grab the current frame using |
Note, getting the It would help if you created a minimal, complete example of the code at plnkr, which should be possible since https://plnkr.co allows including files and the ability to open and communicate with |
An alternative approach for "client.js" would be to set the |
Is not really a requirement, not sure what else I could do?
Only chrome I dont have time for more than one browser any more.
Because is a stream and I need the chunks to send to the clients. If I dont select a timeslice then I will need to wait for the stream to finish which defeats the purpose of streaming :P
I cant use that, I need a compressed video, my bandwidth is limited.
That looks like a solution to my problem. But the api is so weird that I dont understand it. I can't give you an example code, is just too complicated. I have read your codes and examples but none of them solve the problem of broadcasting a MediaStream. The code I posted solves that, but it breaks as soon as a client gets disconnected and rejoins. Thats why I been trying to slice the video in smaller videos. |
As suggested, you can set
You could alternatively use multiple instances of
There is a learning curve when using
Have you taken the time to actually read and try the code at the branches of this repository?
Yes, there are examples of "broadcasting" a This repository was created initially to record multiple media fragments to a single WebM file. The first attempt was using The example of using a JavaScript Module to export a |
Since the target browser is Chrome, consider this code https://github.com/guest271314/MediaFragmentRecorder/blob/imagecapture-audiocontext-readablestream-writablestream/MediaFragmentRecorder.html, which uses What is occuring:
What that means is that an If gather the requirement correctly, will try to create a plnkr to demonstrate an approach to achieve the expected output. |
@titoBouzout An example of streaming "streamer.js" (index.html)
"client.js" (client.html)
|
@titoBouzout A similar approach to https://plnkr.co/edit/KIrO4G?p=preview using "streamer.js" (index.html)
"client.js" (client.html)
|
An alternative approach would be to use At "client.js"
|
@titoBouzout An approach using
|
Thanks, that's a lot of examples. Sadly the canvas one I can't use it because when you get a frame with createImageBitmap you generate an uncompressed image. If you were using a local network that may not be a problem. But over the internet and to too many clients located basically anywhere is difficult |
@titoBouzout Can you describe the issue with generating an uncompressed image? Would substituting |
I need to send these images over the network, around 60 images (1920x1080) per second, thats why video formats exists. Btw, I solved the problem differently. I just restart the stream when I need, and I let the current video finish while at the same time I create a new video on the very same position as the current one. Once the one we watch ends, I remove it and the other plays. |
@titoBouzout Is this issue resolved? |
@titoBouzout Since
|
Thanks, it is resolved yes :) |
Hello!, You seem to be the only one on the complete internet with a problem that I am having.
I have an array of blobs, the array has two videos. I have been trying to play one video after the other without any kind of interruptions. As you can guess, when the second video is appended via sourceBuffer.appendBuffer(blob) the video freezes.
Have you found any solution to this problem? To be able to play two videos without any kind of stop, thanks in advance!
The text was updated successfully, but these errors were encountered: