ImageView or VideoView, which should I display my streaming "video" in android?
<p>I have an android App (native) which streaming video from other camera. </p>

<p>I created a simple server with <code>python</code>, <code>flask</code>, and <code>opencv</code> (to process the video)</p>

<pre><code>from mockCamera import VideoCamera;

import time
import argparse
from flask import Flask, render_template, Response, jsonify, url_for, send_file



# Gallery folder name
STATIC_FOLDER = 'gallery'


# Init Flask app &amp; Camera object
app = Flask(__name__, static_folder=STATIC_FOLDER)

def gen(camera):
    """Video streaming generator function."""
    while True:
        frame = camera.get_frame()
        yield(b'--frame\r\n'
          b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')


@app.route('/video_feed')
def video_feed():
    """Video streaming route."""
    return Response(gen(VideoCamera()),
                mimetype='multipart/x-mixed-replace; boundary=frame')



if __name__ == '__main__':
    # Construct the argument parser and parse the arguments
    ap = argparse.ArgumentParser()
    ap.add_argument("-c", "--camera", help="URL of IP Camera")
    args = vars(ap.parse_args())

    # If the camera argument is not None,
    # then we set it to CAMERA_URL variable
    # otherwise we use default value
    if args.get('camera', None) is not None:
    CAMERA_URL = args['camera']

# Run the app
app.run(host='0.0.0.0', debug=True)
</code></pre>

<p><code>camera.get_frame()</code> will return a frame which processed by opencv</p>

<p>So now, I think my Android App will access <code>/video_feed</code> route, and display video in a <code>ImageView</code>.</p>

<p>But I don't know if it is right or wrong. And how can I do that?</p>

<p>Thanks in advance.</p>

<p>You would usually use a VideoView to show a video, setting it up with the URL to the video on your server.</p>

<p>For example:</p>

<pre class="lang-js prettyprint-override"><code>        //Create the video player and set the video path
        videoPlayerView = (VideoView) rootView.findViewById(R.id.video_area);
        if (videoPlayerView == null) {
            Log.d("VideoPlayer Activity","onCreateView: videoPlayerView is null");
            return null;
        }

        //Set the video URI to the the URL of the video on the server
        videoPlayerView.setVideoURI(yourVideoURL); 
</code></pre>

android python opencv video streaming