jaydeepw / audio-wife

A simple themable & integrable audio player library for Android.
MIT License
237 stars 78 forks source link

Using the defaultview seems only to work once #10

Open gnorbsl opened 9 years ago

gnorbsl commented 9 years ago

I added your player to an DialogFragment with

AudioWife.getInstance().init(getActivity(), uri).useDefaultUi((ViewGroup) rootView, inflater);

It works without a problem and I'm using release() in the onDestroy() method.

http://i.imgur.com/8vxt19m.png

But when I'm starting the fragment a second time, the playerview appears but doesn't show the time nor am I able to play the sound.

http://i.imgur.com/4N3GujQ.png

Any idea what could cause this?

timhannemann commented 9 years ago

I have the same issue, using a custom layout it works like a charm - just the default wants to play just once...

gnorbsl commented 9 years ago

I added a pull request which should fix the issue.

TLHP commented 8 years ago

Any news from jaydeepw? Seem he abandoned this project :(

joreilly commented 8 years ago

Seeing same issue...somewhat of a hack but I copied aw_player.xml from this project (renamed audio_player.xml below) and called following. Ultimately needed to do something like this anyway to have better control over color of some of the controls (tinting based on Palette info taken from image).

        View playerUi = getActivity().getLayoutInflater().inflate(R.layout.audio_player, appBarLayout);
        View playView = playerUi.findViewById(R.id.play);
        View pauseView = playerUi.findViewById(R.id.pause);
        SeekBar seekBar = (SeekBar) playerUi.findViewById(R.id.media_seekbar);
        TextView playbackTime = (TextView) playerUi.findViewById(R.id.playback_time);

        AudioWife.getInstance().init(getContext(), Uri.parse(url))
                .setPlayView(playView)
                .setPauseView(pauseView)
                .setSeekBar(seekBar)
                .setPlaytime(playbackTime);