﻿// JScript File

var g_oAudioPlayer = null;


function playerReady(obj) {
    //recuperate the player
    g_oAudioPlayer = $get(obj.id);
}


function GetAudioPlayer(p_strFilePath, p_strPlayer) {
    if (p_strPlayer == null)
        p_strPlayer = "player";

    var flashvars =
  {
      file: p_strFilePath,
      autostart: "false",
      repeat: "list",
      playlist: "none",
      shuffle: "false", 
      id: p_strPlayer,
      backcolor: "DDDDDD",
      frontcolor: "000066",
      lightcolor: "9999FF",
      screencolor: "000000",
      skin: "SWF/VideoPlayer/simple.swf"
  };

    var params =
  {
      allowscriptaccess: "always",
      allowfullscreen: "false",
      wmode: "opaque"
  };

    var attributes =
  {
      id: p_strPlayer,
      name: p_strPlayer
  };

    swfobject.embedSWF("SWF/VideoPlayer/player.swf", p_strPlayer, "328", "18", "10.0.32", "SWF/ExpressInstall.swf", flashvars, params, attributes);
}


function GetVideoPlayer(p_strFilePath, p_strPlayer) {
    if (p_strPlayer == null)
        p_strPlayer = "player";

    var flashvars =
  {
      file: p_strFilePath,
      id: p_strPlayer,
      backcolor: "FFFFFF",
      frontcolor: "000066",
      lightcolor: "9999FF",
      screencolor: "000000",
      skin: "SWF/VideoPlayer/simple.swf",
      image: "/Images/Gourou_poster_frame.jpg"
  };

    var params =
  {
      allowscriptaccess: "always",
      allowfullscreen: "true",
      wmode: "opaque"
  };

    var attributes =
  {
      id: p_strPlayer,
      name: p_strPlayer
  };

    swfobject.embedSWF("SWF/VideoPlayer/player.swf", p_strPlayer, "512", "308", "10.0.32", "SWF/ExpressInstall.swf", flashvars, params, attributes);
}


function GetPlayListPlayer(p_strFilePath, p_strPlayer) {
    if (p_strPlayer == null)
        p_strPlayer = "player";

    var flashvars =
  {
      file: p_strFilePath,
      id: p_strPlayer,
      backcolor: "FFFFFF",
      frontcolor: "000066",
      lightcolor: "9999FF",
      screencolor: "000000",
      playlist: "bottom",
      skin: "SWF/VideoPlayer/simple.swf",
      plugins: "googlytics-1"
  };

    var params =
  {
      allowscriptaccess: "always",
      allowfullscreen: "true",
      wmode: "opaque"
  };

    var attributes =
  {
      id: p_strPlayer,
      name: p_strPlayer
  };

    swfobject.embedSWF("SWF/VideoPlayer/player.swf", p_strPlayer, "512", "508", "10.0.32", "SWF/ExpressInstall.swf", flashvars, params, attributes);
}


function GetVideoStreamPlayer(p_strStreamFile, p_strStreamRTMP, p_strPlayer) {
    if (p_strPlayer == null)
        p_strPlayer = "player";

    var flashvars = {
        file: p_strStreamFile,
        streamer: p_strStreamRTMP,
        autostart: "true",
        type: "rtmp",
        controlbar: "over",
        backcolor: "FFFFFF",
        frontcolor: "000066",
        lightcolor: "9999FF",
        screencolor: "000000",
        skin: "SWF/VideoPlayer/simple.swf",
        plugins: "googlytics-1"
    };

    var params = {
        allowscriptaccess: "always",
        allowfullscreen: "true",
        wmode: "opaque"
    };

    var attributes = {
        id: "flashObject1",
        name: "flashObject1"
    };

    swfobject.embedSWF("SWF/VideoPlayer/player.swf", p_strPlayer,
        "465", "320", "10.0.32", "SWF/ExpressInstall.swf", flashvars, params, attributes);
}


function GetVideoStreamPlayer2(p_strStreamFile, p_strStreamRTMP, p_strPlayer) {
    if (p_strPlayer == null)
        p_strPlayer = "player";

    var flashvars = {
        file: p_strStreamFile,
        streamer: p_strStreamRTMP,
        autostart: "true",
        type: "http",
        controlbar: "over",
        backcolor: "FFFFFF",
        frontcolor: "000066",
        lightcolor: "9999FF",
        screencolor: "000000",
        skin: "SWF/VideoPlayer/simple.swf",
        plugins: "googlytics-1"
    };

    var params = {
        allowscriptaccess: "always",
        allowfullscreen: "true",
        wmode: "opaque"
    };

    var attributes = {
        id: "flashObject1",
        name: "flashObject1"
    };

    swfobject.embedSWF("SWF/VideoPlayer/player.swf", p_strPlayer,
        "465", "320", "10.0.32", "SWF/ExpressInstall.swf", flashvars, params, attributes);
}

function Play(p_strFilePath) {
    if (g_oAudioPlayer != null) {
        g_oAudioPlayer.sendEvent('STOP');
        g_oAudioPlayer.sendEvent('LOAD', p_strFilePath);
        g_oAudioPlayer.sendEvent('ITEM', 0);
    }
}

function PlayList(p_strList) {

    if (g_oAudioPlayer != null && p_strList != null) {

        var AudioPlayList = new Array();
        AudioPlayList = p_strList.split("_");     

        for (var i = 0; i < AudioPlayList.length; i++) {

            var audio = { file: "" };           
            audio.file = AudioPlayList[i];
            AudioPlayList[i] = audio;
        }

        g_oAudioPlayer.sendEvent('STOP');
        g_oAudioPlayer.sendEvent('LOAD', AudioPlayList);
        g_oAudioPlayer.sendEvent('ITEM',0);
    }
}
