Web部件中的Mediaelement错误(Sharepoint 2010)

时间:2012-10-10 16:48:35

标签: sharepoint-2010 media-player web-parts mediaelement.js

我从mediaelement-and-player.min.js收到错误:

行:44 错误:意外调用方法或属性访问。

我正在尝试在Sharepoint 2010中使用webpart中的播放器。我正在尝试的示例是YouTube示例。

以下是我从网站部分剪下的代码段。

jQuery由SP2010中的母版页加载。

加载插件

this.Controls.Add(new CssRegistration() { Name = "/_layouts/Script/mediaelement/mediaelementplayer.css", EnableCssTheming = true });

this.Controls.Add(new ScriptLink { Name = "/_layouts/Script/mediaelement/mediaelement-and-player.min.js", Language = "javascript", Localizable = false, LoadAfterUI = true });
this.Controls.Add(new ScriptLink { Name = "/_layouts/Script/video.js", Language = "javascript", Localizable = false, LoadAfterUI = true });

HTML code:

writer.Write("<video width='320' height='240' id='player1' >");    
writer.Write("  <!-- Pseudo HTML5 -->");
writer.Write("  <source src='" + VideoPickerUrl + "' type='video/youtube' />");
writer.Write("</video>");
writer.Write("<span id='player1-mode'></span>");

Javascript代码:

$("video").mediaelementplayer({
    enablePluginDebug: true,
    pluginPath: '/_layouts/Script/mediaelement/',
    flashName: 'flashmediaelement.swf',
    success: function (media, node, player) {
    $('#' + node.id + '-mode').html('mode: ' + media.pluginType);
    },
    error: function () {
    $('#' + node.id + '-mode').html('Noe er feil!');
    }
});

修改

当尝试NOT .min js文件时,我也在第970行收到错误。代码在if语句处停止:

for (i=0; i<mediaFiles.length; i++) {
// normal check
    if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== '' 
    // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
       || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
           result.method = 'native';
           result.url = mediaFiles[i].url;
           break;
       }
}

你对我做错了什么有任何提示吗?

祝你好运

的Anders

0 个答案:

没有答案