JWPlayer rtmp redirect from php

823 views Asked by At

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 ?

2

There are 2 answers

0
Junaid On BEST ANSWER

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>
4
emaxsaun On

Change:

type: "mp4",

To:

type: "rtmp",