Search code examples
jwplayerjwplayer6

JWPlayer rtmp redirect from php


I want to redirect dynamically to a file based on where the file requested exists. this is my PHP file code (simplified)

<?php
    header('Location:rtmp://192.168.112.128/vod/got.mp4');
    exit();
?>

JS code

jwplayer("myElement").setup({
    width: "90%",
    aspectratio: "16:9",
    autostart: true,
    skin: "bekle",
    file: "http://192.168.112.128/redirect.php",
    type: "mp4",
});

JWPlayer throws an error Error load media: File could not be player. Is it even possible to redirect to rtmp streams dynamically ?


Solution

  • solution was to use smil. just echo these line from php file

    <smil>
      <head>
        <meta base="rtmp://192.168.112.128/vod/"/>
      </head>
      <body>
         <video src="got.mp4"/>
      </body>
    </smil>