VideoPlayer not working (ios/swift)

0 votes
asked Oct 18, 2017 by daniil108 (330 points)

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 textureId 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)).

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? How to set GLuint textureId as OpaquePointer in setRenderTexture?

Thank you.

1 Answer

0 votes
answered Oct 18, 2017 by albert52 (31,850 points)
Hi,

I'm sorry I didn't solve your problem yesterday.

1.Is there any log which can help us to solve your questions?

2.We are developing samples for the swift.
commented Oct 19, 2017 by daniil108 (330 points)
if video_renderer == nil {
                        video_renderer = VideoRenderer()
                    }
                    if video_player == nil {
                        video_player = VideoPlayer()
                        video_player?.setVideoType(VideoType.Normal)

                        var texId: GLuint = video_renderer!.textureId()
                        let _ = withUnsafePointer(to: &texId) {
                            let unsafePointer8 = $0.withMemoryRebound(to: UInt32.self, capacity: 1, {$0})
                            opPoiner = OpaquePointer(unsafePointer8)
                            video_player?.setRenderTexture(opPoiner!)
                        }
                        video_player?.open("1495088830593.mp4", StorageType.Assets, videoStatusChanged)

                    }
                    video_player?.updateFrame()
                    if (video_player?.isRenderTextureAvailable())! {
                        video_renderer?.render(camera!.projectionGL(0.2, 500), targetInstance.poseGL(), imagetarget.size())
                    }
commented Oct 19, 2017 by daniil108 (330 points)
logs:

2017-10-19 17:12:53.202148+0500 helloar[1652:407465] [DYMTLInitPlatform] platform initialization successful
EasyAR SDK Basic Version 2.1.0
2017-10-19 17:12:53.358813+0500 helloar[1652:407292] Metal GPU Frame Capture Enabled
2017-10-19 17:12:53.360556+0500 helloar[1652:407292] Metal API Validation Enabled
2017-10-19 17:12:53.507121+0500 helloar[1652:407292] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x1c0221fe0> to GL_RENDERBUFFER 1
2017-10-19 17:12:53.507233+0500 helloar[1652:407292] Failed to make complete framebuffer object 8cd6
2017-10-19 17:12:53.521591+0500 helloar[1652:407292] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-10-19 17:12:53.522907+0500 helloar[1652:407292] [MC] Reading from public effective user settings.
load target (true): 1489516331692 (1)
load target (true): 1489511431542 (2)
load target (true): 1489511444901 (3)
load target (true): 1489684882685 (4)
load target (true): 1489684917434 (5)
load target (true): 1494844920862 (6)
load target (true): 1498487818594 (7)
load target (true): 1498645782972 (8)
load target (true): 1498657894814 (9)
load target (true): 1503232968323 (10)
load target (true): 1505822890219 (11)
load target (true): 1506417261411 (12)
load target (true): 1506418137009 (13)
2017-10-19 17:12:54.132767+0500 helloar[1652:407292] refreshPreferences: HangTracerEnabled: 0
2017-10-19 17:12:54.132805+0500 helloar[1652:407292] refreshPreferences: HangTracerDuration: 500
2017-10-19 17:12:54.132819+0500 helloar[1652:407292] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
video status changed: VideoStatus(rawValue: 0)
VideoPlayerReady
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...