PHP 时间记录
在我的网站上,我使用视频播放器 (flowplayer),并且我的剪辑采用 .flv 格式。 我的问题是,是否有任何方法可以创建 php 文件来从 .flv 读取/流式传输数据?就像 feed.php?vid=123
(是的,我知道这可以通过在本地打开文件并输出来完成但这里有一个问题)
用户在流式传输的每一分钟,我想把这些信息存入mysql。我该怎么做?也许使用循环并分块读取文件? ( while() ... ?
)
是的,我知道我可以使用 javascript 做到这一点,但是人们可以使用自己的播放器直接窃取我的 .flv 并占用我的带宽。
On my site there I'm using a video player (flowplayer), and my clips are in .flv format.
My question is if there is any way I can create php file which will read/stream data from .flv? Like feed.php?vid=123
(Yes i know this can be done by opening file locally and outputing it but here is the catch)
Every minute the user is streaming, I want to put that information into mysql. How can I do this? Maybe using a loop and reading file in chunks? ( while() ... ?
)
Yes, I know I could do this using javascript, but people could steal my .flv directly by using own player and eat my bandwidth.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您提供字节,则可以复制并存储字节。您无法防止网站上的数据被盗,因为不提供数据的网站在逻辑上是不可能的。
您可以记录已发送出多少块,但“X 字节 = Y 秒”之间没有直接关联,因为视频压缩比取决于内容。您需要以某种方式解析 .flv 数据并计算出已发送了多少帧,然后您可以从中计算出已显示多少秒/分钟。
一旦你弄清楚了这一点,那么记录“播放时间”将是你最不关心的问题。
If you're serving up bytes, the bytes can be copied and stored. You can NOT prevent theft of data on a website, because a website which does not serve up data is a logical impossibility.
You can record how many chunks have been sent out, but there's no direct correlation between "X bytes = Y seconds", because video compression ratios are content-dependent. You'd need to parse the .flv data somehow and figure out how many frames have been sent, from which you can then figure out how many seconds/minutes have been displayed.
Once you've got that figured out, then recording "play times" will be the least of your problems.