⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startplayer.js

📁 多媒体播放器
💻 JS
字号:
//This file has been modified to work with xLite Player
//Feel free to modify this version any way you see fit.
//XDev Software is not responsible for any damages that may
//occur while using this code. Use at your own risk
var strMovie = ""; 
function get_mediainfo(mediainfoIndex, strMovie) 
{
    switch (mediainfoIndex) 
    {
     case 0:
        return { "mediaUrl": strMovie
                 ,"placeholderImage": ""
                 ,"chapters": [] 
               }; 
     default:
        throw Error.invalidOperation("No such mediainfo");
    }
}

function StartWithParent(parentId, appId) 
{
    new StartPlayer_0(parentId);
}
function StartPlayer_0(parentId, movie) 
{
    strMovie = movie;
    this._hostname = EePlayer.Player._getUniqueName("xamlHost");
    
    Silverlight.createObjectEx( 
                                {   source: 'player.xaml'
                                    , parentElement: $get(parentId ||"divPlayer_0")
                                    , id: this._hostname
                                    , properties:
                                        { width:'100%'
                                            , height:'100%'
                                            , version:'1.0'
                                            , isWindowless:'false;'
                                            , background:backColor 
                                        }
                                    , events:{ onLoad:Function.createDelegate(this, this._handleLoad) }
                                 }
                              );
                              
    this._currentMediainfo = 0; 
}

StartPlayer_0.prototype= {
    _handleLoad: function() 
    {
        this._player = $create(   
                                ExtendedPlayer.Player, 
                                {
                                    autoPlay: true
                                    ,volume : 1.0
                                    ,muted : false
                                }
                                ,{
                                    mediaEnded: Function.createDelegate(this, this._onMediaEnded)
                                    ,mediaFailed: Function.createDelegate(this, this._onMediaFailed)},null, $get(this._hostname)  ); 
                                    this._playNextVideo(strMovie);
                                 }
                                , _onMediaEnded: function(sender, eventArgs) 
                                                {
                                                    window.setTimeout( Function.createDelegate(this, this._playNextVideo), 1000);
                                                }
                                ,_onMediaFailed: function(sender, eventArgs) 
                                                {
                                                    alert(String.format( Ee.UI.Xaml.Media.Res.mediaFailed, this._player.get_mediaUrl() ) );
                                                }
                                ,_playNextVideo: function(movie) 
                                                {
                                                    var cVideos = 1;
                                                    if (this._currentMediainfo<cVideos)
                                                    {
                                                        this._player.set_mediainfo( get_mediainfo( this._currentMediainfo++, movie ) ); 
                                                    } 
                                                }
                          
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -