FMS, Flex, VOD, RTMP videoDisplay to find how many seconds of video are already loaded - flex3

Good day!
I can get which part of file in bytes is loaded using videoDisplay component for RTMP protocol for VOD, I can get the current playing position using videoDisplay.playheadTime. But I want to know how many seconds of video are already loaded (not the length of bufferTime, which remains constant). i used videoDisplay.bytesLoaded when using RTMP it returns nothing , if we uses HTTP it displays number of bytes loaded
The loaded size in bytes is not directly proportional to running time of the video, and while using rtmp im unable to get bytesLoaded too, how i can calculated the Video already loaded.
Any help is really appriciated!

you need NetStream.bufferLength property, but i don't know how to get one from the VideoDisplay instance

Related

How to send a texture with Agora Video SDK for Unity

I'm using the package Agora Video SDK for Unity and I have followed these two tutorials:
https://www.agora.io/en/blog/agora-video-sdk-for-unity-quick-start-programming-guide/
https://docs.agora.io/en/Video/screensharing_unity?platform=Unity
Up to here, it is working fine. The problem is that instead os sharing my screen, I want to send a texture. To do so, I'm loading a png picture and trying to set it to the mTexture you find in the second link. It seems to be working on my computer, but it is like it doesn't arrive to the target computer.
How can I send a texture properly?
Thanks
did you copy every line of the code from the example as is? You may not want to do the ReadPixel part since this reads the screen. You may just read the raw data from your input texture and send it with the PushVideoFrame every update.

HLS Player: Clear video.js buffer on click

I have two live videos feeding an encoder which creates H.264 chunk files and an HLS manifest which is being served by an apache web server.
A browser page using video.js shows a player. Pressing "play" on the browser properly plays the video. It works well.
However, if we change video sources (by flipping the switch in the picture below), there is a considerable delay (10 seconds) before the new content is displayed in the player. I'd like to get that to 3 seconds.
It appears that video.js and/or the HTML5 player in browser is buffering that amount of content. (if you delete the files on the web server, kill apache, or even pull the ethernet cable, the video keeps on playing!)
A button on the web page controls the switch. When clicked, I would also like to clear or reset the player so that it immediately re-reads the index.m3u8 manifest and downloads the new chunks.
So far, haven't found anything promising searching the internet or in the video.js API docs. There are lots of articles on API calls for fetching the current buffer percentage but cannot find any API for clearing it altogether.
Any ideas?
The encoder is set for 3 second chunks and the playlist depth is set for 10 entries.
I had a similar problem. Since i could not find a reliable API for this, i came up with a rather dirty workaround to clear the buffer:
var ctime = player.currentTime();
player.currentTime(0);
player.currentTime(ctime);
This currently works for me in all major browsers.

video.js Change Src When Seeking Without Resting Playback

My video src is an AWS presigned request url, it expires in x amount of time. The video will start playing just fine in video.js. For large video files after the brief url expiration time, changing the seek bar causes a network error because the original src link has expired. How do you refresh the src with another unexpired presigned url without restarting from the beginning of the video? I don't want the video to go back the beginning.
So far I have found that you can capture the change of the seek bar by listening for the event 'timeupdate' and in the passed event testing for e.manuallyTriggered.
Thanks
i had this same issue today. i'm using plyr instead of videojs, so i'm not sure if you can do this exact thing, but my solution was:
bind an error handler to the player for when the link has expired and someone tries to play/seek, and then in the handler...
store the current time of the video
send an ajax request to my server to get an updated signed URL
update the source of the player
set the current time of the video to the previously stored time
it's kind of slow/clunky, but it's the best fix i could come up with at the moment, aside from loading the entire video before allowing playback (which didn't seem like great UX).
update: this does work with videojs...but it doesn't work with either player in Safari, which apparently doesn't send the error event at all.

When does HTML5 video fetch and decode its video?

I load 5 <video autoplay> elements on my page. On some older computers, this can take a lot of CPU.
At what point does a video element fetch its source video, and decode it? Is it only when the video begins to play?
I'm not seeing any data in the "Network" tab in Chrome dev tools, so I'm not sure how to tell when the data is being fetched.
If autoplay is specified, the video automatically begins to play back as soon as it can do so without stopping to finish loading the data and it has nothing to to with when data is fetched.
You should use preload attribute to specify and leave out unbiguity.
This enumerated attribute is intended to provide a hint to the browser about what the author thinks will lead to the best user
experience. It may have one of the following values:
- none: indicates that the video should not be preloaded.
- metadata: indicates that only video metadata (e.g. length) is fetched.
- auto: indicates that the whole video file could be downloaded, even if the user is not expected to use it. the empty string: synonym of the auto value.
Note: If not set, its default value is browser-defined (i.e. each browser may have its default value). The spec advises it to be set to metadata.
Note: Some versions of Chrome only acknowledge autostart, rather than autoplay

Generating a random preview image on a HTML5 video tag

Is it possible to capture a snapshot of a video that's loaded using the HTML5 video element and use that as a preview image until the video loads or the play event is triggered? I know about the poster attribute but I want the thumbnail to be self generated, like a random frame from the video. Sort of what YouTube/Vimeo does.
Thanks,
I don't think that this is possible in pure HTML5. Principally because the stream is not loaded when you see the 'object' in the webpage so the client can't get the desired frame.
However, the best option for you is to save / cache the 'random frame' before loading the page and then use it as the poster of the video. This will allow you to reduce the client work and save the bandwith.
check THIS, which is the first thing that I've found (if you're using PHP and you want a 'quick and dirty' way to get the frame)
Update
Apparently HERE there is a solution with popcorn.js BUT it seems that you can't do it in the way that (I suppose) you need.
This because it would be possible to do this only inside the same domain due to browser security issues.