I have a live strea开发者_如何学JAVAm like this
"mms://streaming.exsample.com:8080/exsample"
i need to make a function to check the link status before showing the stream link in my site. If the stream is down need to show an error to inform to the guest.. Is there a simple jquery solution for this? or php? I have googled for this for hours but couldn't come up with a working solution. Please help.
Because you didn't show any source code, I've used my magic ball to give a start.
Based on the given information define a a javascript variable. Fill this variable with the streaming url, use php for it:
var jsStreamingLinkStr = "<? streamingStr ?>";
Write a javascript function that makes the check and add the correct action to the link. Because you want use JQuery, so it will be more simple for you:
function addClickAction()
{
//Check if the streaming link is correct
if (jsStreamingLinkStr.indexOf("<<correctParameter>>") > -1)
{
$("#myStreaminLink").attr("href", jsStreamingLinkStr);
} else {
//The link is not correct
$("#myStreaminLink").attr("href", "#").click("alert('Sorry, something was wrong');return false;");
}
}
//Start, if the DOM tree is complete loaded by browser
$(document).ready(function()
{
addClickAction();
});
Finally here the link in your page:
<a href="#" id="myStreaminLink">Start stream here</a>
Hopefully it will help to come up with your own idea.
精彩评论