EddyVerbruggen / nativescript-ar

Augmented Reality NativeScript plugin
https://www.nativescript.org/blog/preview-of-augmented-reality-in-nativescript
MIT License
118 stars 36 forks source link

addVideo java.io.FileNotFoundException: video_chroma.sfb: open failed #101

Closed Hethix closed 4 years ago

Hethix commented 4 years ago

Hi

I wan't to view a 360 video in AR. For now I'm just trying to play a video using the .addVideo functionality that are in Nativescript-ar. When I call the ar.addVideo I get this error. "JS: java.util.concurrent.CompletionException: java.io.FileNotFoundException: video_chroma.sfb: open failed: ENOENT (No such file or directory)" I've tried using both a local file and remote files. Other functions of the ar for example .addImage and .addModel works without issues. I've also made sure that .mp4 is included in the webpack.config.js if that is relevant

I hope somebody can help me with my issue

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Scan a surface area. Tap the plane that is detected to place a node, and addVideo.

Is there any code involved?

<template>
  <Page @loaded="pageLoaded">
    <ActionBar title="Welcome to NativeScript-Vue!"></ActionBar>
    <GridLayout columns="*" rows="*">
      <AR
          debugLevel="FEATURE_POINTS"
          planeDetection="HORIZONTAL"
          planeOpacity="0.25"
          :planeMaterial="planeMaterial"
          showStatistics="true"
          @arLoaded="arLoaded"
          @planeTapped="addSomethingToThePlane">
      </AR>
    </GridLayout>
  </Page>
</template>

<script lang="ts">
  import { AR , ARMaterial, ARPlaneTappedEventData, ARNodeInteraction, ARVideoNode} from "nativescript-ar";
  import { Color } from "tns-core-modules/color";
  import { isIOS, screen } from "tns-core-modules/platform";

  const materialPrefix = isIOS ? "Orbitals.scnassets/" : "";

  export default {
    data() {
      return {
        loaded: false,
      }
    },

    methods: {
      arLoaded(arLoadedEventData) {
        console.log(">> AR Loaded! Object: " + arLoadedEventData.object);
      },

      addSomethingToThePlane(arPlaneTappedEventData) {
        const ar: AR = arPlaneTappedEventData.object;

        ar.addNode({
          position: {
            x: arPlaneTappedEventData.position.x,
            y: arPlaneTappedEventData.position.y + 0.01,
            z: arPlaneTappedEventData.position.z
          }
        }).then(node => console.log("node added: " + node))

        ar.addVideo({
          position: {
            x: arPlaneTappedEventData.position.x,
            y: arPlaneTappedEventData.position.y + 0.1,
            z: arPlaneTappedEventData.position.z
          },

          video: "file_example_MP4_1920_18MG.mp4", 
          onTap: (interaction: ARNodeInteraction) => {
            const node = <ARVideoNode>interaction.node;
            if (node.isPlaying()) {
              node.pause();
            } else {
              node.play();
            }
          }
        });
      }
    }
  }
</script>