#!/usr/bin/env bash set -e BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Enable camera on the Raspberry Pi sudo "$BASE_DIR/enable-camera.sh" # Install ffmpeg and supporting tools sudo apt-get install -y ffmpeg lsof inotify-tools nginx # Copy placeholder for audio-only streams cp "$BASE_DIR/audio.jpg" "$HOME/audio.jpg" # Add user to be able to modify nginx directories sudo usermod -a -G "$USER" www-data sudo chmod g+rw /var/www/html # TODO: why is this needed? sudo chmod a+rw /var/www/html sudo cp -f "$BASE_DIR/process-stream.sh" /usr/bin/process-stream.sh sudo cp -f "$BASE_DIR/process-stream.service" /etc/systemd/system/process-stream.service sudo systemctl daemon-reload sudo systemctl enable process-stream # Add hourly job to clear out old data echo "41 * * * * $USER /usr/local/bin/ipfs repo gc" | sudo tee --append /etc/crontab # Install the ipfs video player mkdir "$BASE_DIR/tmp" current_dir="$(pwd)" git clone https://github.com/tomeshnet/ipfs-live-streaming.git "$BASE_DIR/tmp/ipfs-live-streaming" cd "$BASE_DIR/tmp/ipfs-live-streaming" git checkout b9be352582317e5336ddd7183ecf49042dafb33e cd "$current_dir" VIDEO_PLAYER_PATH="$BASE_DIR/tmp/ipfs-live-streaming/terraform/shared/video-player" sed -i s#__IPFS_GATEWAY_SELF__#/ipfs/# "$VIDEO_PLAYER_PATH/js/common.js" sed -i s#__IPFS_GATEWAY_ORIGIN__#https://ipfs.io/ipfs/# "$VIDEO_PLAYER_PATH/js/common.js" IPFS_ID=$(ipfs id | grep ID | head -n 1 | awk -F\" '{print $4}') sed -i "s#live.m3u8#/ipns/$IPFS_ID#" "$VIDEO_PLAYER_PATH/js/common.js" sed -i s#__M3U8_HTTP_URLS__#\ # "$VIDEO_PLAYER_PATH/js/common.js" cp -r "$VIDEO_PLAYER_PATH" /var/www/html/video-player rm -rf "$BASE_DIR/tmp" # Add entry into nginx home screen APP="

IPFS Pi Stream Player

IPFS Video player for Pi Stream.
M3U8 Stream located over ipns
Go and play with built in video player
" sudo sed -i "s#<\!--APPLIST-->#$APP\n<\!--APPLIST-->#" "/var/www/html/index.html"