Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
 
// Create a sensor once in the application
SpringStreams sensor = new SpringStreams(site, appName, getApplicationContext());
...
 
public MyVideoActivity extends Activity {
	
	private static SpringStreams sensor;
	private Stream stream;
 
	public MyVideoActivity(SpringStreams sensor) {
		if(MyVideoActivity.sensor == null) 
			MyVideoActivity.sensor = sensor;
	}
 
	@Override
	protected void onStart() {
		Map<String, Object> atts = new HashMap<String, Object>();
		atts.put("stream", "android/teststream"); // mandatory
		// atts.put("cq", "4711"); // optional see implementation guideline
		// atts.put("ct", "mobile"); // optional see implementation guideline
		stream = sensor.track(new VideoViewAdapter(this.videoView), atts);
		super.onStart();
	}
	
	@Override
	protected void onStop() {
		stream.stop();
		super.onStop();
	}
 
	...
}
 

...