Powenko, Android Tutorial 39-3, Media, play http video

December 21, 2011   ·   0 Comments

Screen Shot 2011-12-21 at 12.42.31 PM

package com.powenko;


import android.app.Activity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class TutorialMediaPlayer_videoActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

VideoView videoView = (VideoView) findViewById(R.id.VideoView1);

String path="http://www.powenko.com/media/1.mp4";

MediaController mediaController = new MediaController(this);

mediaController.setMediaPlayer(videoView);

videoView.setVideoPath(path);

videoView.setMediaController(mediaController);

videoView.requestFocus();

videoView.start();

mediaController.show();

/* MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
// Set video link (mp4 format )
Uri video = Uri.parse("mp4link video ");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
*/
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <VideoView
        android:layout_width="200dip"
        android:layout_height="200dip"

    android:id="@+id/VideoView1"
        />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon