html5+ phone recording and playback recording

Source: Internet
Author: User

<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "Utf-8">    <Metaname= "Viewport"content= "initial-scale=1.0, maximum-scale=1.0, User-scalable=no" />    <title>Recording Playback</title>    <Scripttype= "Text/javascript"src=".. /js/jquery.js "></Script>    <styletype= "Text/css">Body{width:100%;padding:0;margin:0;        }input{padding:. 2rem;margin:. 5rem Auto 0 Auto;font-size:. 5rem;Border-radius:. 5rem;Display:Block;width:5rem;Color:Red;background: White;        }    </style></Head><Body>    <inputtype= "button"value= "Back to Home"ID= "Returnindex">    <inputtype= "button"value= "Click to record"ID= "Recorder" />    <inputtype= "button"value= "Stop Recording"ID= "STOPR">    <inputtype= "button"value= "Play recording"ID= "Player" />    <inputtype= "button"value= "Stop playing"ID= "StopP" /></Body></HTML><Scripttype= "Text/javascript">    /** Page layout rem Reset statement*/    $('HTML'). CSS ('font-size', $ (window). Width ()/( ten);    /** * Phone-side page initialization event, all actions must be written in this event * Otherwise error may occur: Plus is not defind*/Document.addeventlistener ('Plusready', function(){        /** * Get the Recording object Plus.audio.getRecorder () * Define the Save address of the recording file*/        varRecorder=Plus.audio.getRecorder (); varFILEURL= "'; /** * Start recording recorder.record (option, success callback, failed callback) * End Recording recorder.stop () * option: {* F Ilename: File Save folder * Samplerate: Sample rate * Format: Record saved file suffix name *}*/        $('#Recorder'). On ('Touchstart', function() {event.preventdefault (); varoption={filename:"_doc/audio/", Samplerate:'8000', Format:'Amr'} recorder.record ({},function(e) {fileUrl=e; }, function() {Console.log ("Recording failed");        });        }); $('#StopR'). On ('Touchstart', function() {recorder.stop ();                }); /** * Get playback Recording Object Plus.audio.createPlayer (file address) * Start playing Player.play (Success callback, failed callback) * Stop playback Player.sto P () * >>>>>>>>>>>>>>>>>> Player Basic Method >>>>>> ;>>>>>>>>>>> * Play (Success callback, fail callback): Start playing audio * pause (): Pause audio Playback * resum E (): Resume playing audio * STOP (): Stop playing audio * Seekto (how many seconds): Jump to the specified position play audio * getduration (): Get the total length of the audio stream * GetPos Ition (): Gets the current playback position of the audio stream * Setroute (): Set audio output line*/        $('#Player'). On ('Touchstart', function() {event.preventdefault (); //get audio Playback objects            varplayer=Plus.audio.createPlayer (FILEURL); Player.play (function(e) {console.log (e);            Console.log (FILEURL); }, function() {Console.log ("Playback failed");            }); $('#StopP'). On ('Touchstart', function() {player.stop ();        });                }); /** * Back to Home*/        $('#ReturnIndex'). On ('Touchstart', function() {location.href= 'index.html'; })    });</Script>

html5+ phone recording and playback recording

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.