nstudio / nativescript-plugins

@nstudio/nativescript-* plugin workspace.
Apache License 2.0
49 stars 39 forks source link

[nstudio/nativescript-exoplayer][ios] Error in IOS #147

Open takawww opened 4 weeks ago

takawww commented 4 weeks ago

While I am using the given example

pages/test-page.xml

<Page xmlns="http://schemas.nativescript.org/tns.xsd"
      xmlns:exoplayer="@nstudio/nativescript-exoplayer">
        <StackLayout>

            <exoplayer:Video id="nativeexoplayer"
            controls="true" finished="{{ videoFinished }}"
            loop="true" autoplay="false" height="280"
            src="~/videos/big_buck_bunny.mp4" />

            <!-- Remote file to test with https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 -->

        </StackLayout>
</Page>

app-root.xml

<Frame defaultPage="pages/test-page">
</Frame>

after using ns build ios to make a build, and run the build in Xcode, error occurred

*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error:

Uncaught Error: Building UI from XML. @app-root.xml:1:1
 > Building UI from XML. @pages/test-page.xml:5:13
   > Module '@nstudio/nativescript-exoplayer' not found for element '@nstudio/nativescript-exoplayer:Video'.
   > AVPlayerViewController is not defined
 at 
    (file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15643:17)
    at (file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15621:36)
    at (file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:48323:13)
    at EasySAXParser.parse(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:11288:23)
    at parse(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:48366:22)
    at parse(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15630:31)
    at parseInternal(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15566:15)
    at loadInternal(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15478:27)
    at createViewFromEntry(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:15418:45)
    at createRootView(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:1553:77)
    at setWindowContent(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:2531:31)
    at notifyAppStarted(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:2519:22)
    at didFinishLaunchingWithOptions(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:2558:14)
    at NotificationObserver.onReceive(file:///var/containers/Bundle/Application/7ACE034B-DA07-4B4A-B657-921EF9052A2D/xxxxxx/app/vendor.js:2259:14)
', reason: '(null)'
*** First throw call stack:
(0x19db96b28 0x1959eaf78 0x1077c7d38 0x106b64b98 0x106b667bc 0x106b76d58 0x106b7690c 0x19dae151c 0x19dade218 0x19dadd968 0x1e1dd34e0 0x19ff50edc 0x19ff50518 0x1077d4044 0x1077d2710 0x1077b9e4c 0x10778911c 0x1077c3740 0x104c1427c 0x1c0ffed84)
libc++abi: terminating due to uncaught exception of type NSException

My target IOS device is Iphone14 Pro, in IOS 17.4.1

EaglescienceGithub commented 3 weeks ago

I have the same issue. Please let me know if you manage to fix it :)

EaglescienceGithub commented 3 weeks ago

found it, if you us "@nativescript/ios": "8.7.1-next.2024-04-16-8705084282", it works again

takawww commented 3 weeks ago

found it, if you us "@nativescript/ios": "8.7.1-next.2024-04-16-8705084282", it works again

That is not working for me though :(

I have update my packages to latest version

"dependencies": { .... "@nativescript/core": "~8.7.1", "@nstudio/nativescript-exoplayer": "^6.2.0",

"devDependencies": { .... "@nativescript/android": "8.7.0", "@nativescript/ios": "^8.7.1-next.2024-04-16-8705084282", "@nativescript/types": "~8.7.0", "@nativescript/webpack": "~5.0.21",

EaglescienceGithub commented 3 weeks ago

Turns out it only worked on a real device connected to the mac. I had the bug on a real device connected trough xcode before aswell. But a real build still has the issue it seems :(

takawww commented 3 weeks ago

I did try loading the module the in page loaded event. the error message has been changed to

*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error:

Uncaught ReferenceError: AVPlayerViewController is not defined
 at 
    Video

blablabla

example

import { Video } from '@nstudio/nativescript-exoplayer'

export function loaded(args: EventData) {
  const page = <Page>args.object
  const vi: Video = new Video();
  vi.loop=true; 
  vi.autoplay=false;
  vi.height=280;
  vi.src = "~/assets/land_background.mp4";

  var vmPrompt: StackLayout = page.getViewById("video-container");
  vmPrompt.addChild(vi);
}
EaglescienceGithub commented 1 week ago

Maybe try nativescript/ios 8.7.1 (they released a new version that might fix it)

takawww commented 5 days ago

Maybe try nativescript/ios 8.7.1 (they released a new version that might fix it)

Thanks buddy, its work for me