HTML5 How to play local files

Source: Internet
Author: User

HTML5 in the process of operation, a lot of friends will encounter a problem, that is, when playing local files, there are often some problems, so that the HTML5 operation of the local file playback is not smooth or is not able to play normally. Now, let's see how HTML5 plays local files.
The code example is as follows:

<body>
<input type= "file" id= "file" >
<audio id= "audio_id" controls AutoPlay Loop>your browser can ' t support HTML5 audio</audio>
<script>
function Oninputfilechange () {
var file = document.getElementById (' file '). Files[0];
var url = url.createobjecturl (file);
console.log (URL);
document.getElementById ("audio_id"). src = URL;
}  
</script>
</body>

<ul class= "pagination" >
<li><a href= "#" >&laquo;</a></li>
<li><a href= "#" >1</a></li>
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
</ul>
links can be customized in different situations. For links that cannot be clicked with. Disabled and with. Active display is the current page.
<ul class= "pagination" >
<li class= "disabled" ><a href= "#" >&laquo;</a></li>
<li class= "active" ><a href= "#" >1</a></li>
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
</ul>
You can also apply active or disabled to the <span> tag so that you can keep the style you want and remove the click Feature.
<ul class= "pagination" >
<li class= "disabled" ><a href= "#" >&laquo;</a></li>
<li class= "active" ><span>1 <span class= "sr-only" > (current) </span></span></li >
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
</ul>
want a smaller or larger paging? To get more dimensions, add. pagination-lg or. PAGINATION-SM Bar.
<p></p>
<ul class= "pagination Pagination-lg" >
<li class= "disabled" ><a href= "#" >&laquo;</a></li>
<li class= "active" ><span>1 <span class= "sr-only" > (current) </span></span></li >
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
</ul>
<p></p>
<ul class= "pagination" >
<li class= "disabled" ><a href= "#" >&laquo;</a></li>
<li class= "active" ><span>1 <span class= "sr-only" > (current) </span></span></li >
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
</ul>
<p></p>
<ul class= "pagination pagination-sm" >
<li class= "disabled" ><a href= "#" >&laquo;</a></li>
<li class= "active" ><span>1 <span class= "sr-only" > (current) </span></span></li >
<li><a href= "#" >2</a></li>
<li><a href= "#" >3</a></li>
<li><a href= "#" >4</a></li>
<li><a href= "#" >5</a></li>
<li><a href= "#" >&raquo;</a></li>
The code that HTML5 how to play the local file is the above content. Everyone in the operation of the relevant issues may wish to take a look at the above introduction, can help themselves in the completion of the HTML5 local file play operation code to get some help. More about HTML5 local file playback problems can be viewed directly on the professional website, to obtain more professional solutions. However, the answer to the simple question of local file playback on HTML5 is the above-mentioned content.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.