Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display lyrics synchronously in Flex player

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to synchronously display lyrics in Flex player". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to synchronously display lyrics in Flex player".

Flex player synchronously displays lyrics

Have you listened to S.H.E more than a hundred times recently, and have finally done a good job of synchronizing the display of lyrics in the Flex player. This is an extension of the previous Flex player (to achieve playback, buffer progress bar and audio curve display). In this example, the lyrics in lrc text format are parsed and displayed, and the currently played lyrics are highlighted.

To display the lyrics synchronously when playing a song, you must first be able to parse the lyrics in lrc format. Before that, I was going to download the corresponding lyrics directly on the Internet, turn on my machine's thousands of mutes to match the lyrics online, and then use HTTPAnalyzerStdV to monitor all http requests. I found that it was asking this ttlrcct.qianqian.com website to download lyrics, which was still directly applied to thousands of mute servers to download lyrics. But its url parameters are all encrypted. Later, I took a look at KuGou's music, in which I monitored and did not request downloading lyrics. Considering that even if I could find the url address of downloading lyrics online, sending remote requests in flash would still have a security problem, so I finally gave up the method of downloading lyrics directly on the network, or uploaded them all to my website.

Lrc lyrics are actually a file in text format. In Flex, we can use URLLoader to load them. The code is as follows:

/ load the lyrics varlrcUrl:String= xml.item [currIndex] .lrc; if (lrcUrlUrl.nullable index = ") {varlrc:URLLoader=newURLLoader (); / / lrc.dataFormat=URLLoaderDataFormat.VARIABLES; lrc.load (newURLRequest (lrcUrl)); lrc.addEventListener (Event.COMPLETE,LRC_Complete); lrc.addEventListener (IOErrorEvent.IO_ERROR,LRC_IOError);} lrcArr=null;outPutLRCString="; startIndexOf=0;txtLrc.text= ""

Then, in the loaded event, we can get the lrc text string. In this case, we need to process the string and convert it into an Array array, as follows:

PublicfunctiongetLRCArray (lrc:String): Array {varlrcArr:Array=newArray; lrc+= "\ r"; for (vari:int=0;i

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report