Fuse Community

Module not found: FuseJS/StreamingPlayer

hi, i have this error in my application…

Error: : Uncaught require(): module not found: FuseJS/StreamingPlayer in Fuse.Scripting.DiagnosticSubject<MainView.ux:5>


this is a part of app:

    <App Background="Black">

	 <JavaScript>
        let Observable = require('FuseJS/Observable');
        var Player = require('FuseJS/StreamingPlayer');
        let tracks = Observable();

        Player.playlist = [
           {
			"id": 1,
			"name": "RADIO",
			"url": "./test.mp3",
			},
        ]; 

        tracks.addAll( Player.playlist);
        
        let stato = Observable("test");
        Player.on("statusChanged", function(status) {
            stato = JSON.stringify(status);
        });        


        let is_play = false;
        function play(){
            Player.play();
        }

        function next(){
            Player.next();
        }

        function previous(){
            Player.previous();
        }

        function itemClicked(item){
            console.log("Ho cliccato-->"+item["data"]["name"]);
            Player.switchTrack(item["data"]);
        }

        module.exports = {
            itemClicked:itemClicked,
            tracks:tracks,
            status:stato,
            previous:previous,
            play:play,
            next:next
        };

    </JavaScript>

	<ClientPanel>...

what should i do?

Hey.

Have you added StreamingPlayer in .unoproj file?

1 Like

This is my .unoproj file:

{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS",
    "FuseJS/StreamingPlayer"
  ],
  "Mobile": {
  	"Orientations": "Portrait"
  },
  "Includes": [
    "*",
    "Modules/*.js:Bundle",
    "Javascript/**.js:Bundle",
  ],

}

but same error or Package FuseJS/StreamingPlayer was not found

@Alex93Raffica take a look at example project.
Add StreamingPlayer folder path in Projects like this.

{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS"
  ],
  "Mobile": {
    "Orientations": "Portrait"
  },
  "Includes": [
    "",
    "Modules/.js:Bundle",
    "Javascript/**.js:Bundle",
  ],
  "Projects": [
    "src/Fuse.StreamingPlayer.unoproj",
  ]
}

ok. perfect. now everything is good… but the app crash…

@Alex93Raffica do you see some errors when app crashes? What exactly crashes - Fuse studio or preview build? Android or iOs? What device are you using to test?

no… any errors in the console but the preview build app crash on android Samsung Galaxy Note 3

now i’ve tried and says me this error:

Note: Some input files use or override a deprecated API.            Note: Recompile with -Xlint:deprecation for details.

@Alex93Raffica Build regular preview from Fuse studio Preview -> Preview on Android. Remember to connect your phone to computer using USB wire.

@Arturs yes… i’ve already do that… same things

@Alex93Raffica Run uno clean in terminal and build again.

@Arturs this error:

WARNING: build: Access to the path 'Fuse.Text-PInvoke.dll' is denied.

@Alex93Raffica can you share you code, so we can test it?

Sure… this is the MainView.ux


<App Background="Black">

    <JavaScript>
    let Observable = require('FuseJS/Observable');
    var Player = require('FuseJS/StreamingPlayer');
    let tracks = Observable();

    Player.playlist = [
      {
        "id": 1,
        "name": "RADIO",
        "url": "url_of_stream_radio",
        },
    ]; 

    tracks.addAll( Player.playlist);
    
    let stato = Observable("test");
    Player.on("statusChanged", function(status) {
        stato = JSON.stringify(status);
    });        


    let is_play = false;
    function play(){
        Player.play();
    }

    function next(){
        Player.next();
    }

    function previous(){
        Player.previous();
    }

    function itemClicked(item){
        console.log("Ho cliccato-->"+item["data"]["name"]);
        Player.switchTrack(item["data"]);
    }

    module.exports = {
        itemClicked:itemClicked,
        tracks:tracks,
        status:stato,
        previous:previous,
        play:play,
        next:next
    };

</JavaScript>


    <ClientPanel>
        <Grid Columns="auto,1*,auto" Height="70" Dock="Top" Margin="7">
            <Grid ColumnCount="2" RowCount="2" Width="22" Height="22" Margin="10">
                <Each Count="4">
                    <Circle Color="color4" Margin="1.5" />
                </Each>
            </Grid>
                <Image File="Assets/LOGORADIOJAY.png" Alignment="Center" Height="75" Margin="21,10,0,0" />
            <Image File="Assets/search.png" Color="color4" Width="30" Height="30" Margin="10" />
        </Grid>

        <Panel Dock="Top" Height="60">
            <Rectangle ux:Name="indicator" CornerRadius="30" Color="color0" LayoutMaster="p1" Margin="0,10" Width="100%" ZOffset="0.1" />
            <Grid ColumnCount="5" Margin="-30,0">
                <Panel ux:Name="p1" Column="0" ColumnSpan="2" />
                <Panel ux:Name="p4" Column="3" ColumnSpan="2" />
            </Grid>

            <Grid ZOffset="1" Margin="-20,0">
                <Column ux:Name="col1" Width="1" WidthMetric="Proportion" />
                <Column ux:Name="col2" Width="1" WidthMetric="Proportion" />
                <Column ux:Name="col3" Width="1" WidthMetric="Proportion" />
                <Column ux:Name="col4" Width="1" WidthMetric="Proportion" />

                <Text ux:Class="TabHeader" Color="White" Alignment="CenterLeft" Opacity="0" Margin="20,0,0,0" MinWidth="100" />
                <Image ux:Class="TabIcon" Width="25" Height="25" />

                <Panel HitTestMode="LocalBounds" Opacity="1">
                    <Grid Columns="auto,1*" Margin="40,0" Alignment="Left">
                        <TabIcon ux:Name="c1" File="Assets/basket.png" Color="color0" />
                        <TabHeader ux:Name="h1" Value="PLAY" />
                    </Grid>
                    <Clicked>
                        <Set nav.Active="page1" />
                    </Clicked>
                </Panel>
                <Panel HitTestMode="LocalBounds">
                    <Grid Columns="auto,1*" Margin="30,0" Alignment="Left">
                        <TabIcon ux:Name="c2" File="Assets/accountbalance.png" Color="color1" />
                        <TabHeader ux:Name="h2" Value="SOCIAL" />
                    </Grid>
                    <Clicked>
                        <Set nav.Active="page2" />
                    </Clicked>
                </Panel>
                <Panel HitTestMode="LocalBounds">
                    <Grid Columns="auto,1*" Margin="30,0" Alignment="Left">
                        <TabIcon ux:Name="c3" File="Assets/play.png" Color="color2" />
                        <TabHeader ux:Name="h3" Value="EVENTI" />

                    </Grid>
                    <Clicked>
                        <Set nav.Active="page3" />
                    </Clicked>
                </Panel>
                <Panel HitTestMode="LocalBounds">
                    <Grid Columns="auto,1*" Margin="20,0" Alignment="Left">
                        <TabIcon ux:Name="c4" File="Assets/person.png" Color="color3" />
                        <TabHeader ux:Name="h4" Value="SHOP" />
                    </Grid>
                    <Clicked>
                        <Set nav.Active="page4" />
                    </Clicked>
                </Panel>
            </Grid>
        </Panel>
        <PageControl ux:Name="nav">
            <NavigationMotion GotoEasing="BackOut" />
            <Attractor ux:Name="indicatorColorAttractor" Target="indicator.Color" Value="color0" />
            <Rectangle ux:Name="bgColor" Layer="Background" Color="color0" Opacity="0.12" />
            <Attractor ux:Name="bgColorAttractor" Target="bgColor.Color" Value="color0" />
            

            <WhileTrue ux:Name="shrinkIndicatorWidth">
                <Change indicator.Width="90" Duration="0.25" />
            </WhileTrue>

            <Image ux:Class="PagePlaceholder" Margin="8,10,8,0" StretchMode="UniformToFill" ContentAlignment="Top" />

            <Page ux:Name="page1">

                
                <NativeViewHost>
                <WebView Url="http://modernworfare.altervista.org/prova.html" />
                </NativeViewHost>
            

                <WhileActive Threshold="0.5">
                    <Set shrinkIndicatorWidth.Value="false" />
                    <Set indicatorColorAttractor.Value="color0" />
                    <Set bgColorAttractor.Value="color0" />
                    
                </WhileActive>
                <ActivatingAnimation>
                    <Change h1.Opacity="1" />
                    <Change col1.Width="2" />
                    <Change c1.Color="White" />
                </ActivatingAnimation>
            </Page>

            <Page ux:Name="page2">
                <PagePlaceholder />
                <WhileActive Threshold="0.5">
                    <Set shrinkIndicatorWidth.Value="true" />
                    <Set indicatorColorAttractor.Value="color1" />
                    <Set bgColorAttractor.Value="color1" />
                    
                </WhileActive>
                <ActivatingAnimation>
                    <Change h2.Opacity="1" />
                    <Change col2.Width="2" />
                    <Change c2.Color="White" />
                </ActivatingAnimation>

            <Button Text="prova" Clicked="{play}" />

            </Page>
            <Page ux:Name="page3">
                <PagePlaceholder />
                <WhileActive Threshold="0.5">
                    <Set shrinkIndicatorWidth.Value="true" />
                    <Set indicatorColorAttractor.Value="color2" />
                    <Set bgColorAttractor.Value="color2" />
                
                </WhileActive>
                <ActivatingAnimation>
                    <Change h3.Opacity="1" />
                    <Change col3.Width="2" />
                    <Change c3.Color="White" />
                </ActivatingAnimation>
            </Page>
            <Page ux:Name="page4">
                <PagePlaceholder />
                <WhileActive Threshold="0.5">
                    <Set shrinkIndicatorWidth.Value="false" />
                    <Set indicatorColorAttractor.Value="color3" />
                    <Set bgColorAttractor.Value="color3" />
                    
                </WhileActive>
                <ActivatingAnimation Scale="0.333">
                    <Move Target="indicator" X="1" RelativeTo="PositionOffset" RelativeNode="p4" />
                </ActivatingAnimation>
                <ActivatingAnimation>
                    <Change h4.Opacity="1" />
                    <Change col4.Width="2" />
                    <Change c4.Color="White" />
                </ActivatingAnimation>
            </Page>
        </PageControl>
    </ClientPanel>
</App>


this is the .unoproj file

{
  "RootNamespace":"",
  "Packages": [
    "Fuse",
    "FuseJS",
    "Uno.Permissions",
    "Fuse.PushNotifications"
  ],
  "Mobile": {
  	"Orientations": "Portrait"
  },
  "Includes": [
    "*",
    "Modules/*.js:Bundle",
    "Javascript/**.js:Bundle",
  ],

  "Android": {
  "Package": "com.apps.radiojay",
    "GooglePlay": {
      "SenderID": "<20-----36639>"
    },  
  },

  "Firebase": {
    "GoogleServices": {
      "Android": "google-services.json"
    },
  },

  "Projects": [
    "src/Fuse.StreamingPlayer.unoproj",
  ]

}

@Alex93Raffica I can suggest few things:

  1. Try to install Android SDK from Fuse studio Tools -> Install Android SDKs.
  2. Add MediaQuery library to project the same way like in an example project I mentioned.
  3. Build app from terminal fuse preview -t=Android -d, Android Studio should open project and you can debug from here.

Hope this helps.