Skip to content

[Bug]: Using PreviewView doesn't work as pointed out in the example #268

@SharkFourSix

Description

@SharkFourSix

Version

3.0.2

Environment that reproduces the issue

  • Samsung Galaxy Note 8
  • Galaxy A35

RTMP/SRT/... Server

http://192.168.1.45:8088/stream.m3u

Audio configuration

No response

Video configuration

No response

Is it reproducible in the demos application?

Yes

Reproduction steps

Streaming to remote server works fine. Video appears fine on other clients, but the streaming device's preview is just blank. SurfaceView, TextureView, AutoFitTextureView all work, albeit the video gets stretched and skewed.

Following this snippet in the documentation (repo page):

val streamer = cameraSingleStreamer(context = requireContext()) // Already instantiated streamer
val preview = findViewById<PreviewView>(R.id.preview) // Already inflated preview
/**
 * If the preview is a `PreviewView`
 */
preview.streamer = streamer
// Then start the preview
streamer.startPreview()

The app crashes. Reason: Preview surface is not set:

Image

Expected result

The goal is to prevent the video from stretching and skewing. I wanted to use AutoFitSurfaceView, which is deprecated in favor of PreviewView. However, PreviewView either doesn't work or crashes the app.

Preview should be visible.

Actual result

Preview is not visible if calling preview.startPreview().

Calling streamer.startPreview() causes a crash with following output

Image

Additional context

No response

Relevant logs output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions