Playing AAC Stream

584 views
Skip to first unread message

Guillaume Latorre

unread,
Jul 22, 2014, 5:33:32 AM7/22/14
to jpl...@googlegroups.com
Hi,

I would like to know if there is a solution to play AAC Streams with jPlayer (2.6.0) ?

I try with this code :
var stream = {
   title: "Allzic Black Music",
   m4a: "http://allzic04.ice.infomaniak.ch/allzic04.aac?type=.flv"
},
ready = false;
	
$("#jquery_jplayer_1").jPlayer({
   ready: function (event) {
	ready = true;
	$(this).jPlayer("setMedia", stream);
	$(this).jPlayer("play"); // autoplay
   },
   play: function() {
	$('#load').hide();	
   },
   pause: function() {
	$(this).jPlayer("clearMedia");
   },
   error: function(event) {
	if(ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {
	// Setup the media stream again and play it.
	$(this).jPlayer("setMedia", stream).jPlayer("play");
	}
   },
   swfPath: "/assets/public/javascripts/jQuery.jPlayer.2.6.0",
   solution:"flash,html",
   preload: "auto",
   wmode: "window",
   volume: "0.8"
});

Tested with "mp3" or "m4a" on stream parameter, on firefox and chrome and nothing seems to work..

Thanks for your help!

Jonathan2

unread,
Jul 22, 2014, 6:37:29 AM7/22/14
to jpl...@googlegroups.com
On Tuesday, 22 July 2014 10:33:32 UTC+1, Guillaume Latorre wrote:
Hi,

I would like to know if there is a solution to play AAC Streams with jPlayer (2.6.0) ?

I try with this code.....


OK, try this, it works for me - notice that you forgot to use "supplied" - which defaults to mp3.
Also, you were preferring flash over html - not good!
This is a standalone simple demo, just copy and paste, or try online demo here: http://goo.gl/I9QRnJ

<!DOCTYPE html>

<html lang="en">


<head>

   <meta charset="utf-8">

   <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

   <script src="https://cdnjs.cloudflare.com/ajax/libs/jplayer/2.6.3/jquery.jplayer/jquery.jplayer.min.js"></script>

   <script>

       $(document).ready(function () {



           var stream = {

                   title: "Allzic Black Music",

                   m4a: "http://allzic04.ice.infomaniak.ch/allzic04.aac"

               },

               ready = false;


           $("#jquery_jplayer_1").jPlayer({

               ready: function (event) {

                   ready = true;

                   $(this).jPlayer("setMedia", stream);

                   $(this).jPlayer("play"); // autoplay

               },

               play: function () {

                   $('#load').hide();

               },

               pause: function () {

                   $(this).jPlayer("clearMedia");

               },

               error: function (event) {

                   if (ready && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) {

                       // Setup the media stream again and play it.

                       $(this).jPlayer("setMedia", stream).jPlayer("play");

                   }

               },

               swfPath: "/assets/public/javascripts/jQuery.jPlayer.2.6.0",

               solution: "html",

               preload: "auto",

               wmode: "window",

               volume: "0.8",

               supplied: "m4a"

           });


       });

   </script>


</head>


<body>


   <div id="jquery_jplayer_1" class="jp-jplayer"></div>

   <div id="jp_container_1" class="jp-audio"></div>


</body>


</html>






Guillaume Latorre

unread,
Jul 22, 2014, 9:31:36 AM7/22/14
to jpl...@googlegroups.com
Hi Jonathan,

Thanks for your answer, but when I go on your example page, I have no sound...  Tested on Firefox for Mac 30.0 and Chrome for Mac 36.0
And if I add the solution: "html" on my player, it doesn't work and I have the div.jp-no-solution which appears

   <div id="jquery_jplayer_1"<span style="font-size: 15px; font-family: Consolas; c

...

Sree Lakshmi

unread,
Jul 30, 2014, 9:12:13 AM7/30/14
to jpl...@googlegroups.com
Hi,

I have tried the below code with mp4 song in the place of AAC songs it is working in chrome and not working in firefox can u tell me how to change code to play mp4 file in jplayer to work in firefox

Thanks,
lakshmi

Mark Panaghiston

unread,
Jul 31, 2014, 11:18:50 AM7/31/14
to jpl...@googlegroups.com
Fix the mime type for a start!
audio/aac is not a recognised type. It should be audio/mp4 and then it might start working on Firefox.

Im my experience, Chrome does not like playing the MP4 (aac) streams natively. Desktop Chrome that is... On mobile it tends to work fine.

The Flash fallback can have issues with an MP4 live-stream if the metadata is not sent at the start of the track, and even then I think it has issues... Really need to spend some time on that.
Reply all
Reply to author
Forward
0 new messages