Your right RTMP switching will only work with a smil file.
However as the videos need to be protected with expiring links the smil has to be generated on the fly i.e it doesn’t exist and only gets created once requested.
This is something I’m currently working on, it seems rather messy and complicated, anyhow I’m going to do it like so:
<div id="myElement"></div>
<script>
jwplayer("myElement").setup({
playlist: [{
image: "",
sources: [{
file: "path/to/file/smil.php?file_name_720=video-720&file_name_480=/sub-directory/video-480",
type: "rtmp"
}]
}],
width: "100%",
aspectratio: "16:9",
primary: "flash",
});
</script>
Notice that the smil file can be a php file as long as you set type to rtmp. As you can see I’m passing some variables with the file name, which i will extract and use as reference for my video file locations.
The smil file:
<?php
// GET our file name+location variables
$vid_720 = htmlspecialchars($_GET["file_name_720"]);
$vid_480 = htmlspecialchars($_GET["file_name_480"]);
// here is my todo section where the function to create the protected urls will be created
// perhaps we can include s2member's url signing files here and do something like
include 'the/s2member/files/we/need/not/sure/which/ones.php';
$signed_url_720 = do_shortcode('[s2File download="' . $vid_720 . '" url_to_storage_source="true" get_streamer_json="true" /]')
$signed_url_480 = do_shortcode('[s2File download="' . $vid_480 . '" url_to_storage_source="true" get_streamer_json="true" /]')
?>
<smil>
<head>
<meta base="rtmp://yourdistro.cloudfront.net/cfx/st/" />
</head>
<body>
<switch>
<video src="mp4:<?php echo $signed_url_480 ?>" height="480" />
<video src="mp4:<?php echo $signed_url_720 ?>" height="720" />
</switch>
</body>
</smil>
Well I’m going to do something along those lines, perhaps someone can chip in if they know what files need to be included to sign the urls or if they can think of a better way