I am learning HTML and CSS. But I can not add able to add audio and video file by HTML code. What can I do?
Yes, you can use HTML 5 for this because HTML 5 has lots of improvements from the previous versions of HTML. In HTML 5 you can add video's in <video> </video> tags.
Well, there have been pretty much 0 useful responses so far, pretty much boiling down to "use HTML 5". You CAN use HTML 5 to add video to your web pages, however I believe the hassle of converting to three different formats of which you host all three can be more trouble than it's worth. If you want to use it, you can find instructions at html5rocks.com/en/tutorials/video/basics/. However, the easiest and simplest option is probably going to be to add your video to YouTube or Vimeo, and use the Embed code that comes with it. The Audio equivalent of these is SoundCloud. Of the options, it's probably the easiest method and the quickest. If you're hosting things not allowed on YT/Vimeo, then you'll have to install some sort of player or use HTML5 unless anyone can come up with another solution I didn't think of?
Here is the example for audio, nice and simple: <audio class="optional" id="example"><source src="http://yourdomain.com/folder/example.wav" preload="auto"/></audio> <script type="text/javascript">var sample = document.getElementById("example"); example.volume='0.3';</script> HTML: preload="auto" plays the file on page load. you can set "none" if you don't want that (or remove it completely). This is what I know and this works for audio. Since the video needs to be visible (unlike audio), especially if you want player with some controls, this obviously isn't enough, but at least you have a good starting point.