question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No video just audio when using on Sceneform's ViewRenderable

See original GitHub issue

Hi, first of all, thanks for the great Lib!

I am encountering the issue that sound is working but video isnt when using the YouTubePlayerView as a view in Sceneforms ViewRenderable

I embeded the YoutubePlayerView in a CustomView. When using the CustomView in a regular fragment/activity the video works properly…

here is the code

xml

<?xml version="1.0" encoding="utf-8"?>
<com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/youtube_player_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:autoPlay="false"
    app:showFullScreenButton="false" />

CustomView

class VideoRenderableLayout : FrameLayout {

    constructor(context: Context, lifecycle: Lifecycle?, videoId: String?) : super(context) {
        init(lifecycle, videoId)
    }

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
        init(null, null)
    }

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
        init(null, null)
    }

    private fun init(lifecycle: Lifecycle?, videoId: String?) {
        val rootView = View.inflate(context, R.layout.view_youtube_renderable, this)
        val youtubePlayer: YouTubePlayerView = rootView.findViewById(R.id.youtube_player_view)

        lifecycle?.addObserver(youtubePlayer)
        youtubePlayer.addYouTubePlayerListener(object : AbstractYouTubePlayerListener() {
            override fun onReady(initializedYouTubePlayer: YouTubePlayer) {
                videoId?.let {
                    initializedYouTubePlayer.cueVideo(videoId, 0f)
                    initializedYouTubePlayer.pause()
                }
            }
        })
    }
}

Viewrenderable

private suspend fun buildVideoRenderable(augmentedImage: AugmentedImage) {
        val playerView = VideoRenderableLayout(context = applicationContext, lifecycle = lifecycle, videoId = VIDEO_URL_ONE)

        ViewRenderable.builder()
                .setView(this, playerView)
                .build()
                .thenAccept { itRenderable ->
                    val centerAnchor = augmentedImage.createAnchor(augmentedImage.centerPose)
                    val centerAnchorNode = AnchorNode(centerAnchor)
                    addNodeToScene(centerAnchorNode, itRenderable)
                }
}

Maybe someone can help.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
twixridercommented, Jun 1, 2021

no fckn way 👍 thanks man for the info.

0reactions
PierfrancescoSoffritticommented, Jul 13, 2022

As explained in the doc, wasn’t hardware acceleration on by default for you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ViewRenderable not working properly with VideoView ...
TextView 's and Button is coming properly in ARScene, but VideoView is moving along with Camera. enter image description here. My final goal...
Read more >
ViewRenderable not working properly with VideoView · Issue #9
Iam using ViewRenderable with this Layout. ... It is now read-only. google-ar / sceneform-android-sdk Public archive.
Read more >
How can i add a UIView on the mate… - Apple Developer
On android, i use ViewRenderable to load a view , and attach it to a Node, to show a View in the AR...
Read more >
ViewRenderable | Sceneform (1.15.0) - Google Developers
Do not use version 1.17.0 of the Sceneform Maven artifacts. ... setView(context, R.layout.view).build(); viewRenderable = future.
Read more >
Building AR Portal - Yudiz Solutions Pvt. Ltd.
Here, we will use ViroCore, a scene kit for Android ARCore. ... Not only this but a lot of other AR stuff can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found