In VideoPlayer i can't use setRenderTexture() in Swift

+1 vote
asked Oct 16 by daniil108 (330 points)
retagged Oct 16 by daniil108

Hi, I'm trying to use swift sdk, but I had a problem with working with a VideoPlayer.
I use:

public func setRenderTexture(_ texture: OpaquePointer) -> Void

But i cant convert texture id to OpaquePointer. The video plays, I hear its sound. But in place of the marker I see a black rectangle.
please see my code

var pointer:UnsafePointer<GLuint> = UnsafePointer([texture_id])
video_player?.setRenderTexture(OpaquePointer(pointer)).


Please tell me, how to set GLuint textureId as OpaquePointer in setRenderTexture.
Thank you.

2 Answers

0 votes
answered Oct 16 by albert52 (9,820 points)
commented Oct 16 by daniil108 (330 points)
Hi,
thanks for the answer, but it does not help me, I tried to use the video player on objective c, and there everything worked perfectly. It not work work on swift. Do you have a ready implementation for the swift for an example?
commented Nov 26 by yannick (100 points)
That is the Unity docs... !  I do have the same problem right now, how do you pass the texture_id (GLUint/UInt32) to a OpaquePointer. ? I can't find this anywhere.
commented Nov 27 by daniil (280 points)
I solved this problem

videoPlayer?.setRenderTexture(OpaquePointer(UnsafeRawPointer(bitPattern: Int(textureId))!))
0 votes
answered Nov 27 by daniil (280 points)
I solved this problem

videoPlayer?.setRenderTexture(OpaquePointer(UnsafeRawPointer(bitPattern: Int(textureId))!))
commented Nov 28 by yannick (100 points)
Nice. Thanks to you.  Did you manage to make it all work... I'm stuck with a EXC_BAD_ACCESS on the glDrawElements and I don't see why.
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...