需要让用户使用GWT上传视频
我需要让用户在 GWT 站点上传视频,上传后我应该允许他们预览。我不需要任何控件,只需一个播放和停止按钮就足够了,这样我就可以向他们展示预览?
I need to let users upload videos in GWT site, and after uploading I should allow them to preview it. I don't need any controls, just a play and stop button would be enough so that I can show them a preview?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将视频上传到服务器是最简单的部分 - 这就是
FileUpload
小部件的用途。您只需要在服务器端编写某种端点 - Servlet、PHP 脚本等,它们将接收文件并将其存储在某个地方。棘手的部分是预览 - AFAIK,您需要一个媒体流服务器。我所知道的唯一免费且良好的网站是 Red5(site1,site2、site3 - 唐不知道现在的是哪一个=_=)。
另一种方法是使用现有的媒体流网站,该网站公开 API 供用户上传视频 - 例如 YouTube API。该文档展示了如何上传文件(直接从用户或从您的服务器)发送到 YouTube 服务 - 作为回报,您将获得嵌入到您网站上的链接或 HTML 代码。
Uploading the video to your server is the easy part - that's what the
FileUpload
Widget is for. You just need to write some sort of end point on the server side - a servlet, PHP script, etc. that will receive the file and store it somewhere.The tricky part is the preview - AFAIK, you need a media streaming server for that. The only free and good one I know is Red5 (site1, site2, site3 - don't know which one is the current one =_=).
An alternative would be to use an exisiting media streaming site that exposes an API for users to upload videos - like YouTube API. The docs show how to upload a file (directly from the user, or from your server) to the YouTube service - in return you'll get a link or HTML code to embed on your site.