Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Play video

  1. #1
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Play video

    Hi guys,

    My first post here. I would like to seek help about playing video from mysql database. A little background info is I am trying to create a webpage for my company so that new employee could watch those video tuitorial and do the test. I only had limited knowledge about PHP which I learn in school.

    Everything is going smoothly so far however, I am facing problem with uploading video.

    1) Do i store the video in database or under a folder??
    2) How do I make the code dynamic? I wish to had them click on the title and the video will play instead of hardcoding. I found this code online
    <SELECT name=selecta size=1 id=musica onchange=document.all.playera.Filename=document.all.musica.value;>
    <OPTION selected>::::::::: Choose Your Media Sample Here :::::::::</OPTION>
    <OPTION value="Stream URL or Full File Path Goes Here">My Video File </OPTION>
    <OPTION value="Stream URL or Full File Path Goes Here">My Audio File</OPTION>
    <OPTION value="Stream URL or Full File Path Goes Here">My Live Stream</OPTION>
    </select>
    <BR>
    <OBJECT id=playera height=230 width=230 classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95>
    <PARAM NAME="AutoStart" VALUE="True">
    <PARAM NAME="Balance" VALUE="False">
    <PARAM NAME="DisplaySize" VALUE="True">
    <PARAM NAME="Filename" VALUE="">
    <PARAM NAME="Mute" VALUE="False">
    <PARAM NAME="SelectionStart" VALUE="False">
    <PARAM NAME="SelectionEnd" VALUE="False">
    <PARAM NAME="ShowControls" VALUE="True">
    <PARAM NAME="ShowAudioControls" VALUE="True">
    <PARAM NAME="ShowDisplay" VALUE="False">
    <PARAM NAME="ShowPositionControls" VALUE="False">
    <PARAM NAME="Volume" VALUE="1">
    <PARAM NAME="AudioStream" VALUE="False">
    <PARAM NAME="AutoSize" VALUE="False">
    <PARAM NAME="AnimationAtStart" VALUE="False">
    <PARAM NAME="AllowScan" VALUE="False">
    <PARAM NAME="AllowChangeDisplaySize" VALUE="False">
    <PARAM NAME="AutoRewind" VALUE="True">
    <PARAM NAME="BaseURL" VALUE="">
    <PARAM NAME="BufferingTime" VALUE="5">
    <PARAM NAME="CaptioningID" VALUE="">
    <PARAM NAME="ClickToPlay" VALUE="True">
    <PARAM NAME="CursorType" VALUE="0">
    <PARAM NAME="CurrentPosition" VALUE="True">


    However, it is hardcoded as it require the URL for every video.

    Would appreciate all the help

    Thank in advance

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I don't know much about playing videos with classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95", but I do know how to dynamically load YouTube videos.
    So if you would decide to upload your videos to YouTube, you could play them using the following (which is a simple version of THIS; script for using a selectbox for loading videos included):
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
     
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="imagetoolbar" content="no" >
    <!--<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">-->
    
    <title></title>
    
    <script type="text/javascript">
    //This script enables execution of scripts by putting them in the options of selectboxes (if the text of a given option corresponds with the contents of a given script, then the script is executed when the option is clicked on).
    function load_script_container()
    {var div_node=document.createElement('div');
    div_node.setAttribute("id", "script_container");
    document.body.appendChild(div_node);}
    //window.onload=load_script_container (does not work correctly in IE7, so we do it with a timeout)
    setTimeout("load_script_container()",500)
    
    function javascript_in_selectbox(which_box) {
    var optionValue=document.getElementById(which_box).options[document.getElementById(which_box).selectedIndex].value;
    if (optionValue=="none") {}
    else {
    var script_inside_selectbox_option = document.createElement('script');
    script_inside_selectbox_option.type = 'text/javascript';
    script_inside_selectbox_option.text = optionValue;
    while(document.getElementById("script_container").firstChild)
    {document.getElementById("script_container").removeChild(document.getElementById("script_container").firstChild);}
    document.getElementById("script_container").appendChild(script_inside_selectbox_option);
    }
    }
    </script>
    
    
    <script type="text/javascript">
    /* Script for loading YouTube videos. 
    Usage (just some examples): 
    load_video('XT_1iRIQqsQ','') (video starts at the beginning; 
    load_video('XT_1iRIQqsQ',null) (video starts at the beginning; 
    load_video('XT_1iRIQqsQ',0) (video starts at the beginning; 
    load_video('XT_1iRIQqsQ',50) (video starts at 50 secs from start; 
    etc.
    */
    function load_video(video_id,beginpoint)
    {
    frames['my_videos'].location.replace('http://www.youtube.com/embed/'+video_id+'?start='+beginpoint+'&amp;rel=0&amp;autoplay=1&amp;showinfo=0&amp;autohide=0&amp;modestbranding=1');
    }
    </script>
    
    </head>
    
    <body>
    <div style="position: absolute; top:50%; left: 5px">
    <select name="some_selectbox" id="some_selectbox" onchange="javascript_in_selectbox('some_selectbox'); selectedIndex=0">
    <option value="none" selected >Choose Your Video</option>
    <option value="load_video('Tek_i2d7bP4',0)" >The Crog-Magnon Man</option>
    <option value="load_video('jmOxTx0szas',0)">Mendelssohn's Fourth, Second Movement</option>
    <option value="load_video('vt4X7zFfv4k',20)">Soccer (20 secs from start)</option>
    </select>
    </div>
    
    <div style="position: absolute; left:145px; top: 45px; right: 145px; bottom: 45px">
    <iframe name="my_videos" src="http://www.youtube.com/embed/Tek_i2d7bP4?start=0&amp;rel=0&amp;autoplay=1&amp;showinfo=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width:100%; height:100%"></iframe>
    </div>
    
    </body>
    
    </html>
    Arie Molendijk.

  3. #3
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi molendijk, Thank for the reply. However, I am not looking for youtube upload as my company policy is to share the video only internally. I will try to modify your code to see if it is possible to have dynamic load from database

    Thank for your help anyway

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    In case of trouble:
    just give me a static video-object that works on your computer, and I'll make it dynamic.
    Arie.

  5. #5
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi molendijk,

    Sorry i do not get what you mean. My coding knowledge is limited as I had mention in my first post. Mind explaining in simple terms?? Thanks

  6. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I mean that, if you have a video-object like <OBJECT "classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><PARAM NAME="AutoStart" VALUE="True"> etc. working on your computer, I can modify it so as to have video-links like the ones given in my YouTube-example.
    Arie.

  7. #7
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thank for the reply.
    Ok, I get what you mean however, starting from the <OBJECT "classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"><PARAM NAME="AutoStart" VALUE="True"> etc, all this is just the window media player format and I had it working perfectly

    The problem is with this part.
    PHP Code:
    <SELECT name=selecta size=1 id=musica onchange=document.all.playera.Filename=document.all.musica.value;>
    <
    OPTION selected>::::::::: Choose Your Media Sample Here :::::::::</OPTION
    <
    OPTION value="Stream URL or Full File Path Goes Here">My Video File </OPTION
    <
    OPTION value="Stream URL or Full File Path Goes Here">My Audio File</OPTION>
    <
    OPTION value="Stream URL or Full File Path Goes Here">My Live Stream</OPTION
    </
    select
    I do not want to enter each path individually. I wish to do it dynamic by streaming whatever the user press. The video could be retrieve from either the database or the folder. But no youtube.

    Thank alot for your help!!!

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    So you have the object working perfectly, except that the selectbox doesn't work?
    I can only help you if I first see the object that is working for you, value for Filename included.
    Doesn't matter if it doesn't work online.
    Arie.

  9. #9
    Join Date
    Nov 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes, The object is working fine. the media player is working fine. I could enter a youtube url in the code and it would play perfectly.

    The select box work when I put in url or file location manually. However, I am trying to GET what the user select from the previous page and play it instead of manually entering the location of all the files.

    Sorry if my explanation is not very clear. If you still do not get it, I could take more snapshot of my webpage to let you have a better idea.

  10. #10
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by Awesomania View Post
    Yes, The object is working fine. the media player is working fine. I could enter a youtube url in the code and it would play perfectly.
    Can you give me the code?

    Quote Originally Posted by Awesomania View Post
    The select box work when I put in url or file location manually. However, I am trying to GET what the user select from the previous page and play it instead of manually entering the location of all the files.
    You mean when you put the url or file location in the object (not the selectbox), I guess.
    I think I can resolve this, but first I need the code of the object

    Quote Originally Posted by Awesomania View Post
    Sorry if my explanation is not very clear. If you still do not get it, I could take more snapshot of my webpage to let you have a better idea.
    That's a good idea.
    ===
    Arie.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •