mediaplayer that ties into a seekbar or vice vera

All your problems with Audio, Video and Images.

mediaplayer that ties into a seekbar or vice vera

Postby memphishart » Tue Jul 27, 2010 8:23 pm

I have a mediaplayer object that I want a seek bar to be able to control fast forwarding, rewinding or just going to the part that you want, here is the code:
Code: Select all
package com.Hart.VoiceTutor;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class GiveWorkoutAudio extends Activity {
   /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.workoutaudio);
       
        final Intent intent = new Intent();
      intent.setClass(this, voiceTutor.class);
       
        final MediaPlayer mp = MediaPlayer.create(this, R.raw.test);
        mp.start();
        Button pause = (Button) findViewById(R.id.Button01);
        pause.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mp.pause();
            }
        });
        Button play = (Button) findViewById(R.id.Button02);
        play.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
               
               mp.start();
            }
        });
        Button next = (Button) findViewById(R.id.Button03);
        next.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
               
              startActivity(intent);
            }
        });

      }
}

memphishart
Freshman
Freshman
 
Posts: 4
Joined: Mon Jul 19, 2010 5:33 am

Top

Re: mediaplayer that ties into a seekbar or vice vera

Postby memphishart » Tue Jul 27, 2010 8:42 pm

Just to update I did get the seekbar drawn here is the code for that...
Code: Select all
<SeekBar android:id="@+id/SeekBar01"
         android:layout_width="fill_parent"
         android:gravity="center"
         android:layout_height="wrap_content">
         </SeekBar>
memphishart
Freshman
Freshman
 
Posts: 4
Joined: Mon Jul 19, 2010 5:33 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests