Fuse.StreamingPlayer Problem

Hi guys, I’m trying to use Fuse.StreamingPlayer library to create a simple music player. When I tap on one of 2 songs that I insert in the tracklist( one online and the other local) it doesn’t play. Someone can help me?

MainView:

<App>
    <JavaScript>
        let Observable = require("FuseJS/Observable");
        let Player = require("FuseJS/StreamingPlayer");
        let tracks = Observable();

        Player.playlist = [
           {
			"id": 1,
			"name": "Non sei PiewdiPie",
			"artist": "QDSS",
			"url": "https://yt3.ggpht.com/a-/AK162_6Gikpv8RPRpgt3Z6u2Ht87-v5Q6mfmb2EDiQ=s900-mo-c-c0xffffffff-rj-k-no",
			"artworkUrl":"https://everyweeks.com/pZ2j56doGB6c0ykra8lXMj7nuNTDsT79-logo.png",
			"duration": 139
			},
            {
			"id": 2,
			"name": "Sesso e Videogiochi",
			"artist": "QDSS",
			"url": "./sesso_videogiochi.mp3",
			"artworkUrl":"https://everyweeks.com/pZ2j56doGB6c0ykra8lXMj7nuNTDsT79-logo.png",
			"duration": 139
			},
        ]; 

        tracks.addAll( Player.playlist);
        
        let stato = Observable("ciao sono lo stato");
        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>
        <ScrollView>
            <StackPanel>
                <Each Items="{tracks}">
                    <DockPanel Padding="10" Margin="0,1" Background="#fff">
                        <Text Value="{name}" Clicked="{itemClicked}"/>
                    </DockPanel>
                </Each>
            </StackPanel>
        </ScrollView>
        <Panel  Height="20%" Alignment="Bottom" Color="#2f198c" Padding="20">
            <Button Alignment="Center" Clicked="{play}">
                <Text Color="White">Play/Pausa</Text>
            </Button>
            <Button Alignment="CenterLeft">
                <Text Color="White" Clicked="{play}" >Indietro</Text>
            </Button>
                <Button Alignment="CenterRight" Clicked="{next}">
                <Text Color="White">Avanti</Text>
            </Button>
        </Panel>
    </ClientPanel>
    
</App>

What does your .unoproj file look like? If there’s a local file in your project directory that you want to play in the app, you need to make sure it’s included in the app bundle (under "Includes"), like so:
"mytrack.mp3:Bundle".

Uldis wrote:

What does your .unoproj file look like? If there’s a local file in your project directory that you want to play in the app, you need to make sure it’s included in the app bundle (under "Includes"), like so:
"mytrack.mp3:Bundle".

I have just included on "Includes" but it doesn’t work yet because i have the same problem with the online song.

Are you getting any errors? And how are you testing - is it local, or a particular mobile target?

Im’testing with Android preview on a Moto E with android Oreo. However I’m not getting any errors

It would help a lot if you actually got an error that we could work with.

If you have Android Studio installed, you could run the project with uno build -tandroid -d (which will open in AS), and then Run -> Debug from the menu there. If you enable breakpoints, you could see what happens in the native code.

I execute on AS and I receive these logs:

When I tap on Online Song:

01-19 14:00:24.516 8273-8881/com.apps.musicplayertest D/Music Player Test: Ho cliccato-->Non sei PiewdiPie on
01-19 14:00:24.521 8273-8273/com.apps.musicplayertest V/MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
01-19 14:00:24.521 8273-8273/com.apps.musicplayertest V/MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null
01-19 14:00:24.521 8273-8273/com.apps.musicplayertest V/MediaHTTPService: MediaHTTPService(android.media.MediaHTTPService@f46cb31): Cookies: null
01-19 14:00:24.533 8273-9052/com.apps.musicplayertest V/MediaHTTPService: makeHTTPConnection: CookieManager(java.net.CookieManager@dd3fe83) exists.
01-19 14:00:24.533 8273-9052/com.apps.musicplayertest V/MediaHTTPService: makeHTTPConnection(android.media.MediaHTTPService@f46cb31): cookieManager: java.net.CookieManager@dd3fe83 Cookies: null

01-19 14:00:54.845 8273-8285/com.apps.musicplayertest E/MediaPlayerNative: error (1, -2147483648)
01-19 14:00:54.845 8273-8273/com.apps.musicplayertest E/MediaPlayer: Error (1,-2147483648)

When I tap on local song:

01-19 14:03:01.864 8273-8881/com.apps.musicplayertest D/Music Player Test: Ho cliccato-->Non sei PiewdiPie off
01-19 14:03:01.870 8273-8273/com.apps.musicplayertest V/MediaPlayer: resetDrmState:  mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
01-19 14:03:01.870 8273-8273/com.apps.musicplayertest V/MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null

If neither local nor remote files play as a result, the messages suggest that you have a problem with DRM on the files. Unfortunately I have no idea how to work around that, but I’m sure the internet might tell you something more about it.

You should check if this works with an MP3 that does not have any DRM on it.

Uldis wrote:

If neither local nor remote files play as a result, the messages suggest that you have a problem with DRM on the files. Unfortunately I have no idea how to work around that, but I’m sure the internet might tell you something more about it.

You should check if this works with an MP3 that does not have any DRM on it.

DRM Control is a new feature of Android API level 26 but I don’t know where I heve to add DRM controls, whereas I don’t devlop Fuse.StreamingPlayer Library.

If that’s a feature that the StreamingPlayer library lacks, you can just go ahead and make a fork of the repository and implement the missing functionality.

I reckon it would go in one of these files.