Можно ли воспроизводить поток multipart / x-mixed-replace в веб-просмотре внутри javafx? - PullRequest
0 голосов
/ 07 февраля 2020

Я использую flask сервер для потоковой передачи видео с веб-камеры на java клиент. Вот реализация Flask:

def generate():
    # grab global references to the output frame and lock variables
    global outputFrame, lock

    # loop over frames from the output stream
    while True:
        # wait until the lock is acquired
        with lock:
            # check if the output frame is available, otherwise skip
            # the iteration of the loop
            if outputFrame is None:
                continue

            # encode the frame in JPEG format
            (flag, encodedImage) = cv2.imencode(".jpg", outputFrame)

            # ensure the frame was successfully encoded
            if not flag:
                continue

        # yield the output frame in the byte format
        yield(b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + 
            bytearray(encodedImage) + b'\r\n')

@app.route("/video_feed")
def video_feed():
    # return the response generated along with the specific media
    # type (mime type)
    return Response(generate(),
        mimetype = "multipart/x-mixed-replace; boundary=frame")

У меня есть экран веб-просмотра javafx, но он не покажи что угодно. Это потому, что Webview не поддерживает multipart / x-mixed-replace? Какое решение для этого? Есть ли другой способ получить python видеопоток в приложении JavaFX?

...