Cannot play video in iOS

I am including a mp4 video in my app. It can play on android, but the video does not appear at all in iOS 9.1. It crashes on iOS 8.2.

Here are the specs of the video:

Resolution: 960x540

Codec: H264 - MPEG-4 AVC (part 10) (avc1)

Frame rate: 25

Xcode version: 7.3

Corona version: 2016.2855

Can someone advise on why it is not working on iOS?

Thanks!

Hi @claris,

Can we see your code for how you’re trying to play the video in the app?

Brent

Here’s my code:

local function videoListener( event )

    print( "Event phase: " … event.phase )

    if event.errorCode then

        native.showAlert( “Error!”, event.errorMessage, { “Close” } )

        ReplayButton.isvisible = false

    end

end

video = native.newVideo( display.contentCenterX, display.contentCenterY, 960, 540 )

video:load( “assets/activities/PG_T1_mybody_stories/animation.mp4”, system.DocumentsDirectory )

video:seek( 1 )

video:addEventListener( “video”, videoListener )

video:play()

These codes are in the scene:create function. I have declared the video variable above the create function.

I found another post on this forum about video:

https://forums.coronalabs.com/topic/61218-nativenewvideo-causes-app-crash-when-playing-a-downloaded-video-from-documentsdirectory/

It seems like the newest build should solve the problem but my video is still not showing in iOS.

Hi @claris,

Can we see your code for how you’re trying to play the video in the app?

Brent

Here’s my code:

local function videoListener( event )

    print( "Event phase: " … event.phase )

    if event.errorCode then

        native.showAlert( “Error!”, event.errorMessage, { “Close” } )

        ReplayButton.isvisible = false

    end

end

video = native.newVideo( display.contentCenterX, display.contentCenterY, 960, 540 )

video:load( “assets/activities/PG_T1_mybody_stories/animation.mp4”, system.DocumentsDirectory )

video:seek( 1 )

video:addEventListener( “video”, videoListener )

video:play()

These codes are in the scene:create function. I have declared the video variable above the create function.

I found another post on this forum about video:

https://forums.coronalabs.com/topic/61218-nativenewvideo-causes-app-crash-when-playing-a-downloaded-video-from-documentsdirectory/

It seems like the newest build should solve the problem but my video is still not showing in iOS.