schollz / musicsaur

Music synchronization from your browser.
https://radio.schollz.com/
MIT License
281 stars 17 forks source link

Raspberry pi midori "Still loading" #35

Closed BluGeni closed 8 years ago

BluGeni commented 8 years ago

So I have the server working great for my windows desktop but when trying to get a pi working all I get in the midori console is "still loading" I do see the playing song in 1, 2, 3, message sometimes but it goes back to loading. Whats your setup for the raspberry pi. I am doing this with the headless route per the readme instructions. (Version 1.2)

BluGeni commented 8 years ago

Just spun up a brand new raspberry pi image and this time with a wired connection and it seems to be working. My other one on wifi is not though, is a wired connection required?

BluGeni commented 8 years ago

Take that back, I have no sound through the audio jack even after forcing audio to go through it and double checking volume levels.

edit: I have sound if i play an mp3 with omxplayer

schollz commented 8 years ago

No sound likely means that the raspberry pi is syncing. It auto-mutes playback during syncing so that you don't have to listen to unsynced clashing.

To see if its because of slow syncing, log into your pi and type tail -f log to watch the output of midori. Let me know what you find out!

BluGeni commented 8 years ago

The first pi i was trying was definitely still unsynced but with the second one i tried (wired connection) it appears to work I just have no sound with midori. i get sound with omxplayer.

here is my output

xinit /usr/bin/midori -a http://192.168.0.27:5000

X.Org X Server 1.16.4
Release Date: 2014-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.17-1-armmp armv7l Raspbian
Current Operating System: Linux downstairs_speakers 4.1.13+ #826 PREEMPT Fri Nov                                                 13 20:13:22 GMT 2015 armv6l
Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbhei                                                ght=416 bcm2708.boardrev=0xd bcm2708.serial=0xd6641393 smsc95xx.macaddr=B8:27:EB                                                :64:13:93 bcm2708_fb.fbswap=1 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem                                                _base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA                                                0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck                                                .repair=yes rootwait
Build Date: 18 February 2015  05:34:25PM
xorg-server 2:1.16.4-1 (http://www.debian.org/support)
Current version of pixman: 0.33.3
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Thu Dec 24 13:19:53 2015
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
modprobe: FATAL: Module g2d_23 not found.

(midori:1265): GLib-CRITICAL **: Source ID 648 was not found when attempting to                                                 remove it
** Message: console message: http://192.168.0.27:5000/ @105: correct_time_delta

** Message: console message: http://192.168.0.27:5000/ @106: 267,214.5,220.5,139                                                ,176,167,137,149.5,127.5,133,72,54.5,48,63,51,59.5,86.5,83,33,38,45,26,59

** Message: console message: http://192.168.0.27:5000/ @135: 3 seconds left

** Message: console message: http://192.168.0.27:5000/ @140: 2 seconds left

** Message: console message: http://192.168.0.27:5000/ @145: 1 seconds left

** Message: console message: http://192.168.0.27:5000/ @150: playing song

** Message: console message: http://192.168.0.27:5000/ @216: [1450963212769] : N                                                OT in sync (>50 ms)

** Message: console message: http://192.168.0.27:5000/ @217: Browser:  1.5002040                                                86303711
Server: 6.24797216796875
Diff: 4747.768081665039
Mean half-latency: 50.970588235294116
Measured half-latency: -55.02783203125
runningDiff: 4747.768081665039
Seeking to: 10.995740249633789

** Message: console message: http://192.168.0.27:5000/ @232: {"server_timestamp"                                                :1450963212738,"song_time":6.303,"client_timestamp":1450963212686,"next_song":14                                                50963206435,"current_song":"Musiclife.kz - Ñêà÷àòü ìóçûêó, mp3, ïåñíè áåñïëàòíî!                                                 - Akon-Party Animal_(musiclife.kz) by Akon-Party Animal_(musiclife.kz)","is_pla                                                ying":true}

** Message: console message: http://192.168.0.27:5000/ @216: [1450963214257] : N                                                OT in sync (>50 ms)

** Message: console message: http://192.168.0.27:5000/ @217: Browser:  3.1886847                                                019195557
Server: 7.74297216796875
Diff: 4554.287466049194
Mean half-latency: 50.970588235294116
Measured half-latency: -70.02783203125
runningDiff: 9302.055547714232
Seeking to: 17.045027715682984

** Message: console message: http://192.168.0.27:5000/ @232: {"server_timestamp"                                                :1450963214248,"song_time":7.813,"client_timestamp":1450963214184,"next_song":14                                                50963206435,"current_song":"Musiclife.kz - Ñêà÷àòü ìóçûêó, mp3, ïåñíè áåñïëàòíî!                                                 - Akon-Party Animal_(musiclife.kz) by Akon-Party Animal_(musiclife.kz)","is_pla                                                ying":true}

** Message: console message: http://192.168.0.27:5000/ @216: [1450963215753] : N                                                OT in sync (>50 ms)
schollz commented 8 years ago

That output shows its definitely still trying to seek. Was that with a wired connection?

Also, did you try forcing the audio to 3.5mm jack (or HDMI if that's what your using)? Maybe omxplayer can figure it out but midori can't... just sudo raspi-config then Advanced Options -> Audio and choose which you want to force.

BluGeni commented 8 years ago

Yes this was a wired connection with audio forced. I forgot to mention I did hear it play for about 3 seconds with my latest test running it locally (so audio is working) then it just stopped and appears to just keep seeking

BluGeni commented 8 years ago

A small note for others with the latest raspbian image (jessie) that in raspi-config to make sure to select boot to bash and not a gui otherwise xinit wont start.

schollz commented 8 years ago

Okay, thats good!

So seeking on a Raspberry Pi seems to be very stochastic. I've noticed that on bigger files, >4MB, the Pi sometimes has lots of trouble seeking. It seems the larger the file the bigger the problem. For some, it takes >60s to sync correctly, sometimes it never syncs. I'm still trying to figure out whether its a HTML problem or just a tiny-CPU problem. My thought is that it is the latter, as I don't have the problem with any modern laptop/desktop and I haven't experienced the problem running luakit/midori on other computers. Have you tried syncing with modern computers?

The only solution I've found to improve seeking on the Pi is to use ffmpeg (avconv) to decrease the size of the file. You can try it on version 1.3, just uncomment these lines.

BluGeni commented 8 years ago

Update: So i checked out version 1.3 and gave that it a try. At first the problem was the same, the pi could never get in sync or "catch up". but when I pushed next song it was in sync and working perfectly.

Yes I have tried on modern computers and it works perfectly.

schollz commented 8 years ago

Great! I'm glad to hear it works :)

Its possible though that your pi just "got lucky", and it was able to start at the same time in sync and never had to worry about seeking. I've seen that happen several times, too. You can increase time_to_next_song in config.cfg which will give the Pi time to load the song, so they hopefully they can start at the same time more often.

Optimizing for the pi has really been more tricky than I anticipated.