我正在尝试制作可以在 reactjs 中从 torrent 流式传输视频的网页。我找到了这个为 torrentss 提供播放器的库。我不知道在选项中传递什么
import WebTorrentPlayer from 'webtorrent-player'
new WebTorrentPlayer({ opts })
以下是可能的选项:
{
video: Node, // * Video element for the player
player: Node, // * DOM Node that contains the player elements
playerWrapper: Node,
controls: { // Object of player control DOM nodes
functionName: Node|[Node] // DOM Node or Array of Nodes that trigger their respective key functions
},
defaultSSAStyles: String, // Default/fallback styles for subtitles following the ASS format
resolveFileMedia: Function, // Function to return media of currently played file, more below
generateThumbnails: Boolean, // If true, the player will generate thumbnails after a file is downloaded [CPU intensive]
thumbnailWidth: Number, // Number in px for thumbnail width
visibilityLossPause: Boolean, // If true, video playback will pause if the tab lost visibility
immerseTime: Number, // Time in seconds of inactivity that it takes for the player controls to hide
burnIn: Boolean, // If true, PiP will burn-in subtitles real time [only if subtitles are available][VERY CPU intensive]
seekTime: Number, // Time in seconds for the player to seek
streamedDownload: Boolean, // If true, the player will only download pieces directly needed for playback
destroyStore: Boolean, // If false, the files will be kept in storage even after playback finishes
WebTorrentOpts: Object // Object of opts for WebTorrent
}
我应该将哪个节点传递给视频和播放器选项,以及如何访问这些节点?
您可以在此处查看库的 repo webtorrent-player