201 when playing spotify preview urls

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

201 when playing spotify preview urls

Killerbee
Hello Fred

First of all thank you very much for your great library!

I just want to let you know I have a small issue when playing spotify preview urls.
For example this url:
https://p.scdn.co/mp3-preview/ad672a346d38cdcdb7ea6c246282d43522473968?cid=null

In Debug mode function mpg_seek_stream generates a runtime error.
aoffset has sometimes a negative value, for example -128. Probably this is due the fact it's a 30 seconds preview of the full song.

When I changed the mpg_seek_stream code like this I am able to play the previews. More or less "fixed my problem"

function mpg_seek_stream(ahandle: Pointer; aoffset: Integer): Integer;
var
  Stream: TStream absolute ahandle;
begin
  // pipe streams are not seekable but memory and filestreams are
  Result := aoffset;
  try
    if aoffset > 0 then     //instead of aoffset <> 0
      Result := Stream.Seek(soFromCurrent, aoffset);

  except
    Result := 0;
  end;
end;

Maybe you have a better solution or am I doing something wrong here....
Just to let you know and keep up the good work!

KB          
Reply | Threaded
Open this post in threaded view
|

Re: 201 when playing spotify preview urls

Killerbee
Another 201 in this part when song is finished

procedure mpg_close_stream(ahandle: Pointer);
begin
  TObject(ahandle).Free;
end;

Could you please help me on this one?

Thanks KB
Reply | Threaded
Open this post in threaded view
|

Re: 201 when playing spotify preview urls

fredvs
Administrator
Hello KillerBee.

Thanks to report it.

I will take a look tonight, write you later.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: 201 when playing spotify preview urls

fredvs
Administrator
In reply to this post by Killerbee
Hello KillerBee.

Could you try with last commit: 6ae6ecf..db68a1a  ?
https://github.com/fredvs/uos

Thanks.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: 201 when playing spotify preview urls

fredvs
Administrator
In reply to this post by Killerbee
Re-re-hello.

I found something wrong too.

Could you try with this last commit:
db68a1a..d783831

I hope it is fixed now.

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: 201 when playing spotify preview urls

Killerbee
Thanks Fre;D

Problem(s) solved in the latest version.

KB