<<<<<<< HEAD
package se.miun.hls;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Vector;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.Toast;
import android.widget.VideoView;
public class MainActivity extends Activity implements OnCompletionListener, HLSLocalStreamProxyEventListener {
public static final int CONF_SERVER_LISTEN_PORT = 31337;
private final String TAG = this.getClass().getSimpleName();
private String DEFAULT_URL = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
private VideoView video;
private Vector video_uri_list;
private int video_uri_iteration_index = 0;
private HLSLocalStreamProxyInterface hlsProxy;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
video = (VideoView) findViewById(R.id.videoView);
parseAndRun(DEFAULT_URL);
}
public void parseAndRun(String url){
hlsProxy = new HLSLocalStreamProxy(this, CONF_SERVER_LISTEN_PORT);
try {
hlsProxy.setUrl("http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8");
//hlsProxy.setUrl("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8");
Log.d(TAG, "List of file uri:");
/*this.video_uri_list = this.hlsProxy.getStreamUris();
setContentView(R.layout.main);
for (Uri u : this.video_uri_list) {
Log.d(TAG, u.toString());
}*/
video.setOnCompletionListener(this);
if (video_uri_list.size() > 0) {
// Start playing all the video files described by the HLS link
onCompletion(null);
=======
package se.miun.hls;
import java.util.Vector;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.VideoView;
import android.widget.SeekBar.OnSeekBarChangeListener;
public class MainActivity extends Activity implements OnCompletionListener, HLSLocalStreamProxyEventListener {
public static final int CONF_SERVER_LISTEN_PORT = 31337;
private final String TAG = this.getClass().getSimpleName();
private String DEFAULT_URL = "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8";
private VideoView video;
private Vector video_uri_list;
private int video_uri_iteration_index = 0;
private HLSLocalStreamProxy hlsProxy;
private Button playOrPauseButton;
private Button muteButton;
private TextView menuBackground;
private SeekBar seekBar;
private LinearLayout videoLayout;
private boolean menuToggle;
private AudioManager mAm;
private boolean mIsMute;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.video = (VideoView) findViewById(R.id.videoView);
this.menuBackground = (TextView) this.findViewById(R.id.floating_background);
this.playOrPauseButton = (Button) this.findViewById( R.id.floating_play_pause );
this.muteButton = (Button) this.findViewById(R.id.floating_mute);
this.seekBar = (SeekBar) this.findViewById(R.id.floating_seekbar);
this.videoLayout = (LinearLayout) this.findViewById(R.id.videoLayout);
this.menuBackground.setVisibility((int)View.INVISIBLE);
this.playOrPauseButton.setVisibility(View.INVISIBLE);
this.muteButton.setVisibility(View.INVISIBLE);
this.seekBar.setVisibility(View.INVISIBLE);
// Audio mgr
mAm = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mIsMute = false;
menuToggle = false;
parseAndRun(DEFAULT_URL);
/* try {
hlsProxy.parseAndAddToList(Uri
.parse(DEFAULT_URL));
// .parse("http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8"));
Log.d(TAG, "List of file uri:");
this.video_uri_list = this.hlsProxy.getStreamUris();
for (Uri u : this.video_uri_list) {
Log.d(TAG, u.toString());
}
video.setOnCompletionListener(this);
if (video_uri_list.size() > 0) {
// Start playing all the video files described by the HLS link
onCompletion(null);
}
} catch (Exception e) {
e.printStackTrace();
>>>>>>> d58c4945b17c8a6afb9cd049f43721c060fa4050
}
*/
//Videoview |