【教程】Cubieboard變蘋果無線airplay音響

你們應該知道蘋果的airplay技術吧,這個技術是把音樂或視頻圖像等東西傳到和蘋果有簽約音響或者AppleTV上,今天的一次突發奇想,讓我寫出了這篇教程。今天我忽然想到爲何不能把音響和Cubieboard鏈接在一塊兒,變成蘋果Airplay音響呢?果真,我真搜到了一個程序而且把它改編了一下作成了本身的air服務端程序,如今給你們安裝和使用的教程
首先咱們須要用到一個叫air的程序,安裝方法:php

wget http://cb.tonylianlong.com/usr/uploads/2013/05/1334066771.zip -O air.zip
git

unzip air.zip
github

chmod +x air.sh
shell

./air.sh --install
bash


這個程序是airplay的第三方服務端程序,是sharport(airiTunes的一個接收軟件)改編而成。
安裝完後直接輸入air命令來啓動air程序
此時開蘋果設備,你會發現後臺的更改音量的那欄多了一個按鈕,按下後有個airplay的名字叫TonyAIR,這就是我們弄airplay的cb了
IMG_0174.PNG 
按下後跳出菜單,選擇TonyAIR
IMG_0175.PNG 
而後我打開QQ音樂程序隨便點了首歌,沒幾秒鐘音樂就從cb裏出來了。
IMG_0176.PNG 
若是以爲TonyAIR這個airplay的名字難聽,能夠在啓動時輸入: air (你想要的名字) 來用你本身想要的名字
改音樂輸出能夠用:http://cn.cubieboard.org/forum.php?mod=viewthread&tid=191裏面的方法來調整爲板載輸出(音樂是上面那個,麥克風是背面的)
若是要真的弄airplay音響,那就必須開機啓動這個程序,把air命令添加到/etc/rc.local裏就行了(試過可用,不過結尾須要一個「&」號讓他後臺運行)
經測試,沒有任何卡頓現象!另外說下,中止播放時會有幾秒延遲。
如下是安裝shell的代碼,外加註解(文件裏沒有):服務器

#!/bin/bash
socket

#強制用bash開,默認的dash兼容上有點問題
測試

if [ `whoami` == "root" ] ; then
ui

#判斷用戶是否是root
this

if [ "$1"x == "--install"x ] || [ "$1"x == "-i"x ] ; then

#判斷輸入的第一個參數是否是--install or -i

echo "Try to install it"

echo ""

echo "REFREASHing APT"

#三個輸出

apt-get update

apt-get upgrade -y

#更新軟件源

echo "INSTALLing software from APT"

apt-get install wget build-essential libssl-dev libcrypt-openssl-rsa-perl libao-dev libio-socket-inet6-perl libwww-perl avahi-utils pkg-config git -y

#安裝軟件

echo "copy Perl Plugin from GIT"

git clone https://github.com/njh/perl-net-sdp.git /tmp/perlnet

#取得一個perl的聯網插件

echo "Building"

cd /tmp/perlnet

perl /tmp/perlnet/Build.PL

/tmp/perlnet/Build

/tmp/perlnet/Build test

/tmp/perlnet/Build install

#Build和安裝程序

mkdir /usr/air

echo "Downloading File.."

wget http://cb.tonylianlong.com/usr/uploads/2013/05/2971708022.zip -O /usr/air/air.zip

#從個人服務器下載文件,文件是我編譯好的

echo "Unzipping"

unzip /usr/air/air.zip -d /usr/air

#解壓文件

touch /bin/air

echo "#!/bin/bash" > /bin/air

echo "if [ \"\$1\"x == \"\"x ]; then" >> /bin/air

#判斷有沒有輸入第一個參數

echo "/usr/air/start.pl -a TonyAIR" >> /bin/air

echo "else" >> /bin/air

echo "/usr/air/start.pl -a \$1" >> /bin/air

echo "fi" >> /bin/air

chmod +x /bin/air

#權限

echo "OK,filished!"

echo ""

#建立air程序

echo "RE-run this file (or just run \"air\") and not use --install or -i to run Air"

else

if [ ! -f "/bin/air" ]; then

#若是不存在

echo "Air is not installed,try to use --install or -i to install it"

else

/bin/air

#啓動

echo "End!"

fi

fi

else

echo "You are not using \"root\" user!"

echo "You are using "`whoami`" user!"

#輸出用戶名,而且說不是root

fi


原文做者:tll

原文連接:http://forum.cubietech.com/forum.php?mod=viewthread&tid=453&highlight=Cubieboard%E5%8F%98%E8%8B%B9%E6%9E%9C%E6%97%A0%E7%BA%BFairplay%E9%9F%B3%E5%93%8D

相關文章
相關標籤/搜索