Created
January 22, 2015 04:18
-
-
Save cmbaughman/6f30aab37d7c6caeef67 to your computer and use it in GitHub Desktop.
Android simple stream RTSP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class PlayVideoRemote extends Activity | |
| { | |
| private VideoView vView; | |
| private String vSource; | |
| /** Called when the activity is first created. */ | |
| @Override | |
| public void onCreate(Bundle savedInstanceState) | |
| { | |
| //sets the Bundle | |
| super.onCreate(savedInstanceState); | |
| //sets the context | |
| setContentView(R.layout.main); | |
| //get the VideoView from the layout file | |
| vView = (VideoView)findViewById(R.id.vview); | |
| //use this to get touch events | |
| vView.requestFocus(); | |
| //loads video from remote server | |
| //set the video path | |
| vSource ="rtsp://v6.cache1.c.youtube.com/CjYLENy73wIaLQnF4qJzpSt4nhMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYMDFmvL1wMysTQw=/0/0/0/video.3gp"; | |
| //set the video URI, passing the vSource as a URI | |
| vView.setVideoURI(Uri.parse(vSource)); | |
| //enable this if you want to enable video controllers, such as pause and forward | |
| vView.setMediaController(new MediaController(this)); | |
| //plays the movie | |
| vView.start(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment