Introduction
If you have difficulties playing your on-demand or live stream with your embed player on Android devices. You can use the following to invoke the native Android player. Please refer here if you plan to integrate on-demand stream and please refer here if you plan to integrate live stream.
Integration of CDN Video or CDN Video Push service
Create a CDN Video or CDN Video Push service
Please refer to Creating a CDN Video service for more details.
Let's assume that 6534287788.r.cdnsun.net is the Service Identifier of your CDN Video service.
Enable CDN Video service as click-able <a> tag
<div id="mediaplayer"></div> <script type="text/javascript"> $(document).ready(function(){ if(navigator.userAgent.match(/android/i) != null) { $('mediaplayer').html('<a href="rtsp://6534287788.r.cdnsun.net/6534287788/_definst_/mp4:6534287788/myvideo.mp4">Play on Android</a>'); } else { // your player } }); </script>
Or simply add
<a href="rtsp://6534287788.r.cdnsun.net/6534287788/_definst_/mp4:6534287788/myvideo.mp4">Play on Android</a>
below your player.
Please note that your video has to be in MP4 or FLV container format and encoded with H.264 video codec and AAC or MP3 audio codec. Please refer to Services/How-To for your CDN RTSP URL.
AAC vs. MP3
For streaming through RTSP protocol we recommend to use AAC audio codec instead of MP3 because Android does not support MP3 audio codec through RTSP protocol.
Audio files
You have two options how to deliver audio file to Android devices.
- Create audio only file packed in MP4 or FLV container format and encoded with AAC audio codec and use CDN Video or CDN Video Push service to deliver it through RTSP protocol.
- Use CDN Static or CDN Static Push service and deliver the audio file (of any format) through HTTP protocol.
Integration of CDN Live service
Create a CDN Live service
Please refer to Creating a CDN Live service and Services/How-To for more details.
Let's assume that 6534287788.r.cdnsun.net is the Service Identifier of your CDN Live service.
Enable CDN Live service as click-able <a> tag
<div id="mediaplayer"></div> <script type="text/javascript"> $(document).ready(function(){ if(navigator.userAgent.match(/android/i) != null) { $('mediaplayer').html('<a href="rtsp://6534287788.r.cdnsun.net/6534287788/_definst_/mystream">Play on Android</a>'); } else { // your player } }); </script>
Or simply add
<a href="rtsp://6534287788.r.cdnsun.net/6534287788/_definst_/mystream">Play on Android</a>
under your player.
Please note that your origin live stream has to be in MP4 or FLV container format and encoded with H.264 video codec and AAC or MP3 audio codec. Please refer to Services/How-To for your CDN RTSP URL.
AAC vs. MP3
For streaming through RTSP protocol we recommend to use AAC audio codec instead of MP3 because Android does not support MP3 audio codec through RTSP protocol.