Comments (6)
Same as for local file except total length could be determined wrong (-1 for example, I think default Android MediaPlayer causes this behaviour).
See demo app for more info:
Java code
XML layout
from audioview.
how to put in this code
public class AudioPlayerActivity extends AppCompatActivity {
String Content_id,audio_url;
AudioView audioView;
private ProgressDialog pDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audio_player);
audio_url = getIntent().getStringExtra("audio_url");
// Progress dialog
pDialog = new ProgressDialog(this);
pDialog.setCancelable(false);
audioView=(AudioView)findViewById(R.id.audioview);
// pDialog.setMessage("Please Wait...");
// showDialog();
try {
audioView.setDataSource(audio_url);
audioView.start();
} catch (IOException e) {
e.printStackTrace();
}
// hideDialog();
}
@SuppressLint("MissingSuperCall")
@Override
protected void onStop() {
super.onPause();
audioView.pause();
}
@Override
protected void onDestroy() {
super.onDestroy();
audioView.pause();
}
private void showDialog() {
if (!pDialog.isShowing())
pDialog.show();
}
private void hideDialog() {
if (pDialog.isShowing())
pDialog.dismiss();
}
}
from audioview.
I do not see your ProgressBar. Where do you want to put it and what should it do? Default AudioView has SeekBar showing current track percentage completion and allowing to seek over the track.
from audioview.
Show progressbar when audio url load
from audioview.
If you download audio to local storage then it's not related question.
If you want to show progress while AudioView is preparing (it does not matter from url or local) then you could implement AudioViewListener for AudioView and override onPrepared() method. Then set listener through AudioView's setOnAudioViewListener().
from audioview.
Closed due to inactivity
from audioview.
Related Issues (19)
- java.lang.IllegalThreadStateException HOT 1
- its a great library... How to show notification without audioview2 ? HOT 1
- setDataSource(List<Uri>) kotlin not working
- Playing next / previous track HOT 1
- Music stops on sreen rotation.
- Can it stream audio from url? HOT 1
- Issue in UI on playing audio from url
- Audio not playing automatically with start() method HOT 1
- java.lang.NoClassDefFoundError: Could not initialize class android.media.MediaPlayer
- Crash app when click on close icon in notification
- render issue for layout in my androix
- Android 12 pending intent issue
- java.lang.IllegalStateException.android.media.MediaPlayer.getCurrentPosition HOT 4
- Please add license information for your library HOT 1
- AudioPreparedListener HOT 1
- Does it support for UI customization. HOT 1
- Crash in ViewPager HOT 4
- Time is not showing HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audioview.