-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1. When 'src' resource is not available, then the audio component can't show
2. When src is like "\\HOST_IP\test.wav", then after Audio.setSrc(), the client component get a "http://WebServer/WebApp/%5C%5C192.168.1.2%5Ctest.wav" URL, which is not correct
<audio id='player' height='48px' width='300px'/> <listbox mold='select' onSelect='player.setSrc(self.selectedItem.value)'> <listitem value='c:\record\test.vox' selected='true' label='c:\record\test.vox'/> <listitem value='\\192.168.2.1\record\test.vox' label='\\192.168.2.1\record\test.vox'/> <listitem value='ftp://192.168.2.1/record/test.vox' label='ftp://192.168.2.1/record/test.vox'/> <listitem value='http://192.168.2.1/record/test.vox' label='http://192.168.2.1/record/test.vox'/> </listbox>
<audio id='player' player='Windows Media Player' height='48px' width='300px'/>
1. You can see the result html by firebug. The audio component can't be seen is due to the src. Maybe the browser not register for XXX.vox
2. I don't see such result by firebug. src not changed so much.
3. I don't know if we can assign player? It may violate security?
>> 2. I don't see such result by firebug. src not changed so much.
maybe it's because that java.net.URLEncoder.encodeURL() doesn't treat "\\\\192.168.1.1\record\test.vox" as a URL, I must rewrite to a "file://192.168.1.1/record/test.vox" format
>> 1. You can see the result html by firebug. The audio component can't be seen is due to the src. Maybe the browser not register for XXX.vox
As I mentioned before, HTML <embed/> element need determine the MIME type of the media first, it can take a long time to determine the MIME type.
And the .vox format is registered in the OS of client computer. (Does the web-server need to return/config a MIME type for .vox format?)
And, if the protocol of the media resource is something like mms:// rtsp://, then <embed/> does not work too.
>> 3. I don't know if we can assign player? It may violate security?
Some well-known players can be rendered via <object classid='xxx' /> tag, such as Windows Media Player、RealPlayer、QuickTime.
Or, how about org.zkoss.zul.Audio provide a mechanism that developers can specify a HTML template to reander audio component?
-----------
Now, I must manually create a piece of HTML code to render a Windows Media Player in browser to play .vox files. It's quick to render it in browser, and it CAN play .vox file, but I must need a URL to play, I can't take advantage of org.zkoss.zul.Audio.setContent().
// 创建 Windows Media Player 播放器对象 // 由于目前 ZK 的 Audio 组件只通过 embed 元素来创建播放器,速度慢且文件不存在时无法展示播放器,所以改用手工创建播放器的方法 public void CreateWindowsMediaPlayer_FavoriteRecord (String sSrc) { String sURL = bEncodeURL ? new java.net.URI(sSrc.replace("\\","/")).toASCIIString() : sSrc; StringBuilder sbClientHTML = new StringBuilder (); sbClientHTML.append ("<object classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' id='theMediaPlayer' width='480' height='64'>"); sbClientHTML.append (" <param name='URL' value='"); sbClientHTML.append (sURL); sbClientHTML.append ("'/>"); sbClientHTML.append (" <param name='volume' value='100'/>"); sbClientHTML.append (" <param name='autoStart' value='-1'/>"); sbClientHTML.append ("</object>"); htmlMediaPlayer_FavoriteRecord.setContent (sbClientHTML.toString()); }
Asked: 2009-04-28 08:50:07 +0800
Seen: 833 times
Last updated: Aug 18 '09