README (4645B)
1 television 2 ========== 3 4 A simple LAN/WLAN screen public http broadcasting service. 5 6 7 motivation 8 ---------- 9 10 I've been in situations of giving a lecture or a workshop where there 11 was no screen or projector available, or... No cable. The usual 12 workaround that I've seen friends and colleagues use is to have everyone 13 join jitsi/zoom/bbb/etc and do the screen sharing there. This works but 14 feels like a grotesque variation of the "a multinational corporation's 15 service as the easiest way of copying files between two nearby devices" 16 entry from the crappy everyday tech bingo. 17 18 So here is a response with television, a simple binary that takes 19 screenshots of your desktop at regular intervals and serves the result 20 over http on an amazingly well formatted html page that can be accessed 21 by everyone over LAN/WLAN with their browser. It's *not* a video stream, 22 it's really a 1fps style screensharing web thing which is plenty enough 23 for slides, GUI/TUI/CLI action, etc. 24 25 Of course I hear you say, "OK but then we have all these extra screens 26 now!". Well true, but think about the new creative setups you can come 27 up with, not everyone needs to have their own screen ffs! Take that as 28 an opportunity to completely rearrange the room. Make small groups, I 29 don't know. You can do it, I have faith in you. 30 31 firefox, chrome, chromium, edge: works great (desktop and mobile) 32 safari: does not work at all, *boooo* *throws stuff at safari* 33 34 35 build 36 ----- 37 38 go mod download 39 go build -ldflags="-s -w" television.go 40 41 42 installation 43 ------------ 44 45 cp television /somewhere/nice 46 cp -r www /also/somewhere/nice 47 48 49 usage 50 ----- 51 52 television [options] 53 54 -idle user activity detection (default off) 55 56 Only works with X, makes use of X11 Screen Saver extension. By 57 default, television will make a new screenshot every 2 seconds. 58 This will work everywhere but is quite wasteful, when -idle is 59 used screnshots are made only when user activity is detected. As 60 a bonus, it means that the clients will reuse of the last cached 61 image when there is no activity, therefore reducing drastically 62 the network traffic too! 63 64 -port http port number (default 8888) 65 66 -snap custom snap command (default none) 67 68 By default, television relies on kbinani/screenshot for taking a 69 screenshot and pixiv/go-libjpeg for generating a jpg. This should 70 work everywhere, however there can be more effective and efficient 71 ways to take the screenshot (see examples), or it could be 72 interesting to process the image before serving it. With -snap the 73 whole mechanism for taking the screenshot, saving it as jpeg and 74 placing it in the www folder is skipped and will be replace by 75 your very own (TM) shell oneliner, assuming you have a working sh. 76 Have fun. You deserve it. 77 78 -www www directory (default "./www") 79 80 By default, television will look for the www folder in the same 81 folder from which television is executed, this is far from ideal. 82 I'm sure you have better ideas. I will suggest one in the 83 examples section. 84 85 86 client shortcut 87 88 'f' enter/exit fullscreen browser mode 89 90 91 examples 92 -------- 93 94 ./television 95 96 What does this do? 97 98 It just werks. Just run it like this from the git folder (after building 99 it), and ask everyone to join http://your.local.ip.address:8888/tv 100 101 --- 102 103 ./television -port 666 104 105 What does this do? 106 107 -port 666 Somehow you insisted to serve the result on 108 http://your.local.ip.address:666/tv 109 110 --- 111 112 television \ 113 -snap "scrot /tmp/www/tv/tv.tmp.jpg \ 114 && mv /tmp/www/tv/tv.tmp.jpg /tmp/www/tv/tv.jpg" \ 115 -www /tmp/www \ 116 -idle 117 118 What does this do? 119 120 -snap "scrot etc" replaces the builtin screenshot and jpeg encoding by 121 scrot and this is to my knowledge the fastest and most 122 efficient way to take screenshots on X. See HACKING for 123 non-X feels. 124 125 -www /tmp/www uses /tmp/www as root directory for serving the files. 126 on systems where /tmp is in fact tmpfs this is a good 127 idea because this could save a lot of disk write access. 128 129 -idle takes a screenshots only when user activity is detected, 130 namely keyboard input or mouse movement. Shh. Don't move. 131 See. Nothing happens. 132 133 --- 134 135 ./television \ 136 -snap "import \ 137 -colors 2 -dither FloydSteinberg -window root www/tv/tv.tmp.jpg \ 138 && mv www/tv/tv.tmp.jpg www/tv/tv.jpg" 139 140 What does this do? 141 142 -snap "import etc" this is now a lowtechmag presentation :) 143