Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid and MJPEG
    primarykey
    data
    text
    <p>I need to get the mjpeg stream from an IP camera, anyone know the right way do it? I googled a bit and I find this example</p> <p><a href="http://www.anddev.org/mjpeg_on_android_anyone-t1871.html" rel="noreferrer">http://www.anddev.org/mjpeg_on_android_anyone-t1871.html</a></p> <p>but I've been stucked when I tried to get the stream from another activity called by the main activity. Here the code:</p> <p>Main acitivity</p> <pre><code>package com.test; public class IntentTest extends Activity { /** Called when the activity is first created. */ ListView myListView = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myListView = (ListView)findViewById(R.id.listView); final ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); items.add("00408C944B9A"); final ArrayAdapter&lt;String&gt; aa; aa = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, items); myListView.setAdapter(aa); myListView.setOnItemClickListener(listClicked); } private OnItemClickListener listClicked = new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position, long id) { // TODO Auto-generated method stub Intent i = new Intent(IntentTest.this, OtherActivity.class); i.putExtra("MAC", myListView.getItemAtPosition(position).toString()); startActivity(i); } }; } </code></pre> <p>Second activity</p> <pre><code>package com.test; import com.test.mjpeg.mjpegsample.MjpegView.*; import com.test.parser.JSONParse; public class OtherActivity extends Activity { /** Called when the activity is first created. */ private MjpegView mv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras != null){ String mac = (String)extras.get("MAC"); Log.i("Other", "----&gt;" + mac); TextView tv = (TextView)findViewById(R.id.textView); tv.setText(mac); String URL = "myurl"; requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); mv = new MjpegView(this); setContentView(mv); mv.setSource(MjpegInputStream.read(URL)); mv.setDisplayMode(MjpegView.SIZE_BEST_FIT); mv.showFps(true); } } public void onPause() { super.onPause(); mv.stopPlayback(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload