A more 'streamable video' approach to WebTorrent video playback #2237
MasterEvilAce
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've used WebTorrent (browser) to implement a VOD (mp4) playback system based on scheduling. Using renderTo/streamTo, each player does not have the ability to seek, and player.currentTime is sync'd for everybody. A webseed provides the initial file while pieces are ideally shared between users via P2P.
Example: At 12 PM UTC time, the player starts the VOD at currentTime = 0. If at 12:38 PM a new user loads the page, their currentTime is set to 0:38.
Because of this, there is no need to download pieces of the vod from before currentTime, as they will not be played.
A big issue with WebTorrent (browser) is that the whole VOD seems to be stored in memory at present time, and the entire thing is downloaded even if the user only watches for ten minutes.
An ideal scenario would be:
With this scenario, bandwidth is not potentially 'wasted' due to sections 1) and 4), but the player maintains a healthy playback buffer and P2P ratio is maximized. A new user connecting could very quickly fill their 600 second buffer via P2P alone (avoiding the webseed.) Additionally, RAM usage is minimized since we are not processing a multi-GB file, only a 600 second portion of it at most.
Obviously the examples of 60 / 600 seconds could be set by variables in order to optimize/tweak.
It sounds like all of this might be possible by either:
a) allowing a custom 'strategy' implementation where a developer can pick and choose pieces, and avoid old ones altogether?
b) allowing pieces to be 'prioritized' like files can, so a developer can set this logic manually outside of WebTorrent, and webtorrent will just follow the prioritization (which would ideally allow -1 priority in order to skip pieces entirely.)
Additionally, in order to further reduce RAM usage, the ability for WebTorrent to evict old/unneeded pieces of a file from memory/store would allow an extremely flexible "streaming" experience of video files, without needing to deal with external store implementations or browser limitations.
Even without taking into consideration my specific use case here (no seeking), this functionality being added to WebTorrent could come in handy to other developers by allowing them to more finely control just how much cpu/ram/bandwidth is utilized. P2P functionality is still fully retained as a single seed can still supply all pieces, while individual players (all at different currentTime's) can supply their own subsets of pieces.
Beta Was this translation helpful? Give feedback.
All reactions