【教程】Cubieboard变苹果无线airplay音响
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
大家應(yīng)該知道蘋果的airplay技術(shù)吧,這個(gè)技術(shù)是把音樂(lè)或視頻圖像等東西傳到和蘋果有簽約音響或者AppleTV上,今天的一次突發(fā)奇想,讓我寫出了這篇教程。今天我突然想到為什么不能把音響和Cubieboard連接在一起,變成蘋果Airplay音響呢?果然,我真搜到了一個(gè)程序并且把它改編了一下做成了自己的air服務(wù)端程序,現(xiàn)在給大家安裝和使用的教程
首先我們需要用到一個(gè)叫air的程序,安裝方法:
wget http://cb.tonylianlong.com/usr/uploads/2013/05/1334066771.zip -O air.zip
unzip air.zip
chmod +x air.sh
./air.sh --install
這個(gè)程序是airplay的第三方服務(wù)端程序,是sharport(airiTunes的一個(gè)接收軟件)改編而成。
安裝完后直接輸入air命令來(lái)啟動(dòng)air程序
此時(shí)開(kāi)蘋果設(shè)備,你會(huì)發(fā)現(xiàn)后臺(tái)的更改音量的那欄多了一個(gè)按鈕,按下后有個(gè)airplay的名字叫TonyAIR,這就是咱們弄airplay的cb了
?
按下后跳出菜單,選擇TonyAIR
?
然后我打開(kāi)QQ音樂(lè)程序隨便點(diǎn)了首歌,沒(méi)幾秒鐘音樂(lè)就從cb里出來(lái)了。
?
如果覺(jué)得TonyAIR這個(gè)airplay的名字難聽(tīng),可以在啟動(dòng)時(shí)輸入: air (你想要的名字) 來(lái)用你自己想要的名字
改音樂(lè)輸出可以用:http://cn.cubieboard.org/forum.php?mod=viewthread&tid=191里面的方法來(lái)調(diào)整為板載輸出(音樂(lè)是上面那個(gè),麥克風(fēng)是背面的)
如果要真的弄airplay音響,那就必須開(kāi)機(jī)啟動(dòng)這個(gè)程序,把a(bǔ)ir命令添加到/etc/rc.local里就好了(試過(guò)可用,不過(guò)結(jié)尾需要一個(gè)“&”號(hào)讓他后臺(tái)運(yùn)行)
經(jīng)測(cè)試,沒(méi)有任何卡頓現(xiàn)象!另外說(shuō)下,停止播放時(shí)會(huì)有幾秒延遲。
以下是安裝shell的代碼,外加注解(文件里沒(méi)有):
#!/bin/bash
#強(qiáng)制用bash開(kāi),默認(rèn)的dash兼容上有點(diǎn)問(wèn)題
if [ `whoami` == "root" ] ; then
#判斷用戶是不是root
if [ "$1"x == "--install"x ] || [ "$1"x == "-i"x ] ; then
#判斷輸入的第一個(gè)參數(shù)是不是--install or -i
echo "Try to install it"
echo ""
echo "REFREASHing APT"
#三個(gè)輸出
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
#取得一個(gè)perl的聯(lián)網(wǎng)插件
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
#從我的服務(wù)器下載文件,文件是我編譯好的
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
#判斷有沒(méi)有輸入第一個(gè)參數(shù)
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
#權(quán)限
echo "OK,filished!"
echo ""
#創(chuàng)建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
#啟動(dòng)
echo "End!"
fi
fi
else
echo "You are not using \"root\" user!"
echo "You are using "`whoami`" user!"
#輸出用戶名,并且說(shuō)不是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
轉(zhuǎn)載于:https://my.oschina.net/u/1982421/blog/294651
總結(jié)
以上是生活随笔為你收集整理的【教程】Cubieboard变苹果无线airplay音响的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: C# WPF 之 遍历子控件
- 下一篇: 解决Mac app store更新时[n