dynamic change jwplayer video path

Tags: , , ,



basically i wish to achieve like user type file name,then video will be pop up

what i want to do is i was tried to pass textbox value as jwplayer path to play video

if i typed Video/video.mp3 into textbox and i click “button” , my jwplayer able to play video.mp3

what i want to do is juz typed “video” then jwplayer able to starts

by doing that i plan to use database to do checking

once user type video, then database will return jwplayer/video.mp3 and pass the value to jwplayer script, but i cant achieve that!

javascript

    function playSelected() {
        var a = document.getElementById("TextBox2").value;

        jwplayer("mediaplayer").setup({
            flashplayer: "jwplayer/player.swf",
            file: a,
            image: "jwplayer/preview.jpg"
        });
    }

button

<input type="button" runat="server" value="Click me!" onclick='playSelected()'>

textbox

<asp:TextBox ID="TextBox2" runat="server">

Answer

Declare in javascript

var a = "video/" + document.GetElementbyID("textbox2").value + ".mp3";

Then you only have to input the video name alone and the rest is added dynamically.



Source: stackoverflow