No video just audio when using on Sceneform's ViewRenderable
See original GitHub issueHi, 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:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
no fckn way 👍 thanks man for the info.
As explained in the doc, wasn’t hardware acceleration on by default for you?