Tag:Play audio

  • Detailed explanation of Android development steps of recording and playing audio (dynamic access permission)


    Steps: Configure permissions: <manifest xmlns:android=”http://schemas.android.com/apk/res/android” package=”com.work.mediaplay”> <uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE”></uses-permission> <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE”></uses-permission> <uses-permission android:name=”android.permission.RECORD_AUDIO”></uses-permission> Code steps: public class MainActivity extends AppCompatActivity implements View.OnClickListener{ private Button btn_start, btn_stop; private ListView lv_content; private File sdcardfile = null; private String[] files; private MediaRecorder recorder=null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); getSDCardFile(); getFileList(); } /** *① Instantiate control […]

  • Method of playing cached audio files by wechat applet in IOS


    Most of the time, we want to cache data locally in advance to save bandwidth. However, recently, we encountered some small problems in the process of playing the cached audio files by wechat applet, and then we need to adopt different playback strategies for Android and IOS. First of all, if the audio tag is […]

  • The compatibility of inserting audio file into HTML and playing audio file in browser


    The following is about how to insert audio files into HTML. After my local test, I have summarized some problems (playing MP3 files) 1、<embed type=”audio/mp3″ src=”” autostart=true loop=false></embed> Problem: normal on IE8 (played through media player plug-in), but not on IE6 and IE7You need to install QuickTime plug-in in in Firefox to playChrome can play […]

  • Solve the problem of Vue project component switching and automatic audio playback under IOS wechat


    Recently, I have been working on an English answer project. The project needs to get the score by answering the question. The question type of the project is divided into three pages: the beginning page, the answer page and the end page. For each question type, I have made the corresponding components. Each time I […]

  • The method to solve the problem that the audio of wechat public platform webpage cannot be played under Linux


    Some people find an interesting problem in Linux system, that is, audio files cannot be played on the wechat public platform of web version. This means that you can’t hear the language messages from the other side in Linux system. How to solve this problem? terms of settlement:1. Modify the browser ID to windows.2. If […]

  • Implementation of playing audio with phonegap


    Examples are as follows: <!DOCTYPE html> <html> <head> <meta charset=”UTF-8″> <title>Compass Example</title> <script type=”text/javascript” charset=”UTF-8″ src=”cordova.js”></script> <script type=”text/javascript” charset=”UTF-8″> document.addEventListener(“deviceready”, onDeviceReady, false); function onDeviceReady() { } var my_media=null; var mediaTimer=null; function playAudio(src){ my_media=new Media(src,onSuccess,onError); my_media.play(); if(mediaTimer==null){ mediaTimer=setInterval(function(){ my_media.getCurrentPosition( //Successful callback function(position){ if(position>-1){ setAudioPosition((position/1000)+”sec”); } }, //Error callback function (e){ console.log(“Error getting pos=”+e); setAudioPosition(“Error: “+e); } […]

  • Android uses SoundPool to play audio


    Recently, I did a small function of playing audio, using the blank interface to simply record it (click on the ImageButton above to play, and ignore the ImageView below). Activity_picture.xml page: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” tools:context=”.PictureActivity”> <ImageButton android:id=”@+id/ibCogVideo” android:layout_width=”100dp” android:layout_height=”100dp” android:src=”@mipmap/ic_launcher” /> <ImageView android:id=”@+id/ivCogPicture” android:layout_width=”300dp” android:layout_height=”300dp” android:layout_marginTop=”100dp” android:src=”@mipmap/ic_launcher” /> […]

  • Python implementation of audio playback and recording function sample code


    Audio preprocessing This lecture mainly introduces some basic audio processing methods, laying the foundation for the following speech recognition. Three Ways of Playing Audio There are several ways to play audio using python: os.system() Os. system (file) calls the system application to open the file, which can be a picture or audio file. Disadvantage: To […]