5

I'm trying to make a online stream player with JW Player 6.

If I create a smil file with all the quality version of streams and use the code below it works fine:

<script>
    jwplayer("myElement").setup({
        playlist: [{
            sources: [{
                file: "/player/smil.asp"
        }]
      }],
      type: 'rtmp'
    });
</script>

smil file:

<smil>
  <head>
    <meta base="rtmp://host/app" />
  </head>
  <body>
    <switch>
      <video src="quality1" system-bitrate="720" />
      <video src="quality2" system-bitrate="360" />
    </switch>
  </body>
</smil>

I want to create the smil file on the fly based on user's quality selections. (ie: discard bitrates higher than 720)

I used an asp file to create smil file dynamically but it didnt work:

file: "/player/smil.asp"

the error: Error loading player: No playable sources found

of course I set header type to application/octet-stream in the asp file but didnt solve the problem.

I also tried saving same asp file with smil extension and than set the asp handler for smil files in IIS setting. it works perfectly when I call in browser, but jw player shows same error.

any recommendation?

thanks.

dvdmn
  • 5,659
  • 6
  • 39
  • 51
  • Can you provide a link to where the issue is happening? – emaxsaun Feb 19 '13 at 02:28
  • For the dynamic player , what happens if you set the player's type variable to smil? – emaxsaun Feb 19 '13 at 17:25
  • What about type=rtmp ? Some more information (at the bottom) - http://www.longtailvideo.com/support/jw-player/28836/media-format-support – emaxsaun Feb 19 '13 at 17:55
  • still doesnt work.the player works without these definitions if I use smil file directly. I modified asp file like this: http://codep.in/s but still no luck. – dvdmn Feb 19 '13 at 18:57
  • I think application/octet-stream is wrong, it should be - application/smil, right? – emaxsaun Feb 19 '13 at 19:55
  • I found it on a web site and worked for on player2.htm, i ll try your recommendation and let you know. – dvdmn Feb 19 '13 at 23:12
  • didnt make any change. I noticed something. when I load player2 page it shows nothing about smil file firebug's network tab until I click play. (autoplay is off on both players) player1 gives the error message before I click play. it could be something related with source verification in jw player. What do you think? – dvdmn Feb 20 '13 at 18:43
  • Yes, I think that because the extension is .asp, not .smil, the player doesn't know what to do with it. – emaxsaun Feb 20 '13 at 18:50
  • I believe in this case, type:rtmp, needs to be set, for something like this, to trick the player to look past the extension. – emaxsaun Feb 20 '13 at 20:55
  • I also tried running asp files under smil extension. the content was same as running smil file but it didnt work. I dont know why player thinks the file is not valid. It must be something related with player's source code or api's code. – dvdmn Feb 20 '13 at 22:38
  • In you embed code, adding type:rtmp should make the player think the file can be read even though the extension is .asp, not .smil – emaxsaun Feb 20 '13 at 22:40
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/24860/discussion-between-dvdnhm-and-ethan-longtail) – dvdmn Feb 21 '13 at 01:02
  • I modified the js api code in the question, could you check it for me please? Did I add type into right place? – dvdmn Feb 21 '13 at 01:03
  • 3
    I think that this line: file: "/player/smil.asp" Needs to be: file: "/player/smil.asp", type: "rtmp" I think that will do it. – emaxsaun Feb 21 '13 at 17:26
  • YES!! I was trying to do pretty much the same thing, except with .NET. Adding type: "rtmp" finally did the trick. I banged my head on this for 2 days - may I suggest a mention of this in the documentation somehwere? So glad I found this...you should post this as an answer. – esvendsen Feb 22 '13 at 16:33
  • Yes it solved my problem too. I'll add this as answer. Thanks Ethan for your patience. – dvdmn Feb 22 '13 at 19:10

1 Answers1

3

Defining type of source solves the problem.

sources: [{
    file: "/player/smil.asp",
    type: "rtmp"
}]

Thanks to Ethan for his patience.

dvdmn
  • 5,659
  • 6
  • 39
  • 51