I am learning the new HTML5 tags, and have a question about the video tag that I cannot seem to find a good example/answer for.
Can I provide a source as a URL, or does the source have to route from the web server? I am just trying to play with an example to see what it looks like, and use a youtube video as the source. Is this possible?
The source can indeed be a valid URL, which of course in this case needs to be a URL to a valid video file.
Related
Ok i wanna do a simple question but i do not know if it comes also with a simple answer..
I will ask the simplest scenario that derives from this question... How can i "put" a video in a html page(site) from my pc or server that can be watched by everyone.
I dont want to embed a youtube video in the site but i want that video to be "embed" from my server or pc. What im actually asking is how to make a site like youtube(remove the part that users can upload videos) that has videos and are being "streamed"(i think thats the word) directly from youtube servers.
Given your file tree looks like this :
index.html -- The web page you're serving
media/
media/bunny.mp4 -- Your video file
media/bunny.jpg -- [optional] A cover picture while the use plays the video.
And in index.html
<video src="media/bunny.mp4" width="400" height="222" controls poster="media/bunny.jpg"></video>
But if you're searching for an alternative where the user can't download the file (and that is a requirement even Youtube doesn't fulfil), you can read this post HTML5 live streaming
Or simply use a ready solution like Plex Media Server
I want to get the real url of a video embeded with <video>,<object>,<embed> tag.
For example https://www.youtube.com/watch?v=Th9nu3RDwEM ,i use Chrome' Dev Tools and find the <video> tag and it's "src" attribute is:
blob:https%3A//www.youtube.com/9ceed388-a540-4857-85d4-a1538276dc45.
But when i type this into browser,nothing happens.
So i want to know is there any ways to get the real url ? And since "src" is not the real video url, what does it mean?
Normally I would embed a gif like so.
<img src="http://i.imgur.com/awHPuBp.gifv">
Although I get an error that the image could not be loaded.
I'm just wondering what mark up I will need to use so that I can display the GIFV.
GIFV is created by imgur and more information can be found here.
I just checked that demo site. It seems that they just convert the video to a webm video (in case of Firefox). Check this file here which comes from the demo: http://i.imgur.com/A61SaA1.webm
So I would say you could also just use the <video> tag to embedd those "gif" files. I just guess that use a feature detection and a video converting logic. No idea what this nonsense should be for.
Can I use torrent file with videos and this videos loaded in ?
I have torrent with 3 videos. And I have one simply html page with video.js.
Video 1: Wellcome.wemb
Video 2: Introduction.webm
Video 3: What we play.webm
So... Can I load first video from torrent in video ?
You could use torque. It's not pure javascript, but quite powerful.
http://torque.bittorrent.com/labs/
Check out http://onehash.com/ for an example of exactly what you want to do.
For a pure javascript implementation (I believe limited to chrome), check out jstorrent:
https://github.com/kzahel/jstorrent
And here it is deployed: http://jstorrent.com/
You could do it manually or try writing some server software that extracts the torrent. If you find out how to do that, then try to do it ahead of time instead of each time at run-time.
1) Is there a way in java to stream an audio file from ftp on my jsp page?
2) How can I play an audio file in jsp without audio file being download on client browser (like live stream) - temporary internet files
please help with some code example
Streaming audio from a file does not have anything to do with the JSP itself.
You want to embed your audio file into the page using HTML tags. You can do this directly like:
<embed src="audiofile.mp3">
Or build something a bit more fancy using a Flash movie as an audio player, or find a JavaScript library. Here is a page on how to do it with various methods.
The JSP can provide the audio file name and perhaps other options, but that's all it has to do -- the rest is handled by plain old HTML tags.
You can find more information by searching the Web for the terms "embed" and "audio".
If you're already on HTML5, just use <audio> element, See also the HTML Dog tutorial.
<audio src="file.wav" controls="true" />
If you're not on HTML5 yet, audio in a webbpage is usually to be included by the HTML <embed> element (which uses the platform default player) or the HTML <object> element (wherein you can specify a more specific player for which the webbrowser can eventually automagically download the necessary plugin software).
<object data="file.wav" />
Either way, it should point to an URL which returns the audio stream. This can be just a static file in the public webcontent, next to the JSP file. E.g. http://example.com/context/file.wav. But when the audio file is stored outside the public webcontent or in a database, then you'd like to stream it via a Servlet. Basically just get an InputStream of it (using e.g. FileInputStream) and then write it to the OutputStream of the response along a correct set of response headers.
Noted should be that JSP is irrelevant in this particular question. It's just a view technology providing a template to write HTML in and send it to the webbrowser.
That said, websites which plays audio are generally considered annoying and generally scare off visitors. Keep this in mind if you consider User Experience important.