该对象不接受'createMediaPlayer'属性或方法 [英] The object does not accept the 'createMediaPlayer' property or method
问题描述
<跨度ID = "x_x_result_box" LANG = "EN"> <跨度> 跨度> 跨度>
<跨度ID = "x_x_result_box" LANG = "en"> 亲爱的,
我正在配置显示模板,以便在SharePoint 2013搜索结果中使用它。
想法是使用sharepoint中的原生演示控件来显示图像滑块和视频。
我能够用条件区分图像和音频文件识别内容的类型(图像或视频)。
但我是没有播放视频文件。
我使用的是原生Silverligth播放器"mediaplayer.js",但是当我运行该页面时,它会显示以下消息:
"该对象不接受'createMediaPlayer属性或方法(CoreRender:~sitecollection / _catalogs / masterpage / Display Templates / Content Web Parts / Item_Carousel_Silverligth.js)"
然后我粘贴显示模板的代码(项目)
< html xmlns:mso ="瓮:架构 - 微软COM:办公室:办公"的xmlns:MSDT = QUOT; UUID:C2F41010-65B3-11d1-A29F-00AA00C14882">
< head>
< title> Carousel Silverligth< / title>
<! - [if gte mso 9]>< xml>
< mso:CustomDocumentProperties>
< mso:TemplateHidden msdt:dt =" string"> 0< / mso:TemplateHidden>
< mso:ManagedPropertyMapping msdt:dt =" string">
" Picture URL" {URL de la imagenes}: " PublishingImage; PictureURL; PictureThumbnailURL",
&NBSP;" TIPO德contenido" {TIPO contenido ELEMENTO}:" ContentType的",
"链接网址"{DirecciónURLdelvínculo}:"路径",
"Titulo"{Título }:" Title",
" VideoFileURL" {URL de archivodevídeo}:" UserEncodingURL; ExternalMediaURL; DefaultEncodingURL;",& / em>
"第1行"{Línea1 }:"",
" ContentTypeId"
< / mso:ManagedPropertyMapping> < mso:MasterPageDescription msdt:dt =" string">Presentacióndeelementos de la vista carousel。< / mso:MasterPageDescription>< mso:ContentTypeId msdt:dt =" string"> 0x0101002039C03B61C64EC4A04F5361F385106603< / mso: ContentTypeId>< mso:TargetControlType
msdt:dt =" string"> ;;#Content Web Parts;#< / mso:TargetControlType>< mso:HtmlDesignAssociated msdt:dt =" string"> 1< / mso:HtmlDesignAssociated>< mso:HtmlDesignConversionSucceeded msdt:dt =" string"> True< / mso:HtmlDesignConversionSucceeded>< mso:HtmlDesignStatusAndPreview
msdt:dt =" string"> http: //eformsdesa.trabajo.gob.ar/_catalogs/masterpage/Display%20Templates/Content%20Web%20Parts/Item_Carousel_Silverligth.html,Conversióncorrecta。< / mso:HtmlDesignStatusAndPreview>< / mso:CustomDocumentProperties>& lt; / xml><![endif] - >
< / head>
< body>
<! -
警告:不要尝试将HTML添加到此部分。只有第一个< div> 的内容
在< body>里面执行显示模板代码时将使用标记。任何HTML
您添加到此部分不会成为展示广告模板的一部分。
- >
< script>
$ includeLanguageScript(this.url,"〜sitecollection / _catalogs / masterpage / Display Templates / Language Files / {Locale} /CustomStrings.js");
;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; $ includeCSS(this.url,"〜sitecollection / _catalogs /母版/显示模板/内容Web部件/ carousel.css");
&NBSP;&NBSP; RegisterSod( " mediaplayer.js",Srch.U.urlTokenExpansion(" / _ layouts / mediaplayer.js"));
&NBSP;&NBSP; RegisterSod(" sp.publishing.resources.resx",Srch.U.urlTokenExpansion(" / _ layouts / ScriptResx.ashx?name = sp.publishing.resources& culture = {Locale}"));
RegisterSodDep(" mediaplayer.js"," sp.publishing.resources.resx");
< / script>
<! -
使用下面的div创作您的显示模板。以下是一些需要注意的事项:
*使用"pound underscore"覆盖任何JavaScript逻辑,如下所示。 (#_ ... _#)令牌
在评论中。
*使用分配给变量的值使用"下划线等于"
(_#= ... =#_)令牌。
- >
< div id =" item_carousel">
<! - #_
var encodedId = $ htmlEncode(ctx.ClientControl.get_nextUniqueId()+" _carousel_");
var linkURL = $ getItemValue(CTX,&]连结网址");
&NBSP; linkURL.overrideValueRenderer($ urlHtmlEncode);
'p> &NBSP; VAR videoFileURL = $ getItemValue(CTX," VideoFileURL");
&NBSP; VAR的contentType = $ getItemValue(CTX ," TIPO德Contenido");
&NBSP; VAR标题= $ getItemValue(CTX," TITULO");
var line1 = $ getItemValue(ctx," Line 1");
&NBSP; line1.overrideValueRenderer($ contentLineText);
&NBSP; VAR pictureURL = $ getItemValue(CTX,"图片URL");
var pictureId = encodedId +" picture";
var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL,1280,720,ctx.CurrentItem," cbs-picture3LinesImg",line1,pictureId);
var containerId = encodedId +" container";
var pictureLinkId = encodedId +" pictureLink";
var videoId = encodedId +" video";
var pictureContainerId = encodedId +" pictureContainer";
&NBSP; VAR dataContainerId = encodedId + QUOT; dataContainer英寸;
&NBSP; VAR line1LinkId = encodedId + QUOT; line1Link" ;
var line1Id = encodedId +" line1";
var dataDisplayTemplateTitle =" ItemCarousel";
_# - >
< div class =" cbs-picture3LinesContainer" id =" _#= containerId =#_"数据displaytemplate = QUOT; _#= $的HTMLEncode(dataDisplayTemplateTitle)=#_">
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP; < div class =" cbs-picture3LinesImageContainer" id =" _#= pictureContainerId =#_">
<! - #_
if(contentType ==" Activo de imagen"){_# - >
; _#= pictureMarkup =#_
<! - #_} else
{
var MediaURL = videoFileURL;
var PreviewURL = pictureMarkup;
var MediaTitle = title;
var AutoPlay =" true" ;;
var Loop =" false";
mediaPlayer.createMediaPlayer(
document.getElementById(pictureContainerId),pictureContainerId,'1600', '900px',
{
displayMode:'inline',
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; mediaTitle:MediaTitle,
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP; MEDIASOURCE:MediaURL,
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; previewImageSource:PreviewURL,
autoPlay:AutoPlay,
loop:Loop,
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; mediaFileExtensions:'wmv; wma; avi; mpg; mp3;',
;&NBSP; silverlightMediaExtensions:'wmv; wma; mp3;'
});
} _# - >
< / div>
< / div>
< / div>
< / body>
< / HTML>
非常感谢你。
尝试检查mediaPlayer是否已加载。
例如:
如果未加载,请尝试使用
includeScript(this.url," ~sitecollection / _layouts / 15 / mediaplayer.js")而不是RegisterSod;
最佳注册ards,
利跨度>
Dear,
I am configuring a Display Template to use it in SharePoint 2013 search results.
The idea is to show an image sliders and videos, using the native presentation control in sharepoint.
I was able to differentiate between image and audio files with a conditional that identifies the type of content (Image or Video).
But I'm not getting the video files to play.
I am using the native Silverligth player "mediaplayer.js", but when I run the page it shows me the following message:
"The object does not accept the 'createMediaPlayer' property or method (CoreRender: ~ sitecollection / _catalogs / masterpage / Display Templates / Content Web Parts / Item_Carousel_Silverligth.js)"
Then I paste the code of the display template (item)
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>Carousel Silverligth</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:ManagedPropertyMapping msdt:dt="string">
"Picture URL"{URL de la imagenes}:"PublishingImage;PictureURL;PictureThumbnailURL",
"Tipo de Contenido"{Tipo contenido elemento}:"ContentType",
"Link URL"{Dirección URL del vínculo}:"Path",
"Titulo"{Título}:"Title",
"VideoFileURL"{URL de archivo de vídeo}:"UserEncodingURL;ExternalMediaURL;DefaultEncodingURL;",
"Line 1"{Línea 1}:"",
"ContentTypeId"
</mso:ManagedPropertyMapping><mso:MasterPageDescription msdt:dt="string">Presentación de elementos de la vista carousel.</mso:MasterPageDescription><mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId><mso:TargetControlType
msdt:dt="string">;#Content Web Parts;#</mso:TargetControlType><mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated><mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded><mso:HtmlDesignStatusAndPreview
msdt:dt="string">http://eformsdesa.trabajo.gob.ar/_catalogs/masterpage/Display%20Templates/Content%20Web%20Parts/Item_Carousel_Silverligth.html, Conversión correcta.</mso:HtmlDesignStatusAndPreview></mso:CustomDocumentProperties></xml><![endif]-->
</head>
<body>
<!--
Warning: Do not try to add HTML to this section. Only the contents of the first <div>
inside the <body> tag will be used while executing Display Template code. Any HTML that
you add to this section will NOT become part of your Display Template.
-->
<script>
$includeLanguageScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Language Files/{Locale}/CustomStrings.js");
$includeCSS(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Content Web Parts/carousel.css");
RegisterSod("mediaplayer.js", Srch.U.urlTokenExpansion("/_layouts/mediaplayer.js"));
RegisterSod("sp.publishing.resources.resx", Srch.U.urlTokenExpansion("/_layouts/ScriptResx.ashx?name=sp.publishing.resources&culture={Locale}"));
RegisterSodDep("mediaplayer.js", "sp.publishing.resources.resx");
</script>
<!--
Use the div below to author your Display Template. Here are some things to keep in mind:
* Surround any JavaScript logic as shown below using a "pound underscore" (#_ ... _#) token
inside a comment.
* Use the values assigned to your variables using an "underscore pound equals"
(_#= ... =#_) token.
-->
<div id="item_carousel">
<!--#_
var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + "_carousel_");
var linkURL = $getItemValue(ctx, "Link URL");
linkURL.overrideValueRenderer($urlHtmlEncode);
var videoFileURL= $getItemValue(ctx, "VideoFileURL");
var contentType = $getItemValue(ctx, "Tipo de Contenido");
var title = $getItemValue(ctx, "Titulo");
var line1 = $getItemValue(ctx, "Line 1");
line1.overrideValueRenderer($contentLineText);
var pictureURL = $getItemValue(ctx, "Picture URL");
var pictureId = encodedId + "picture";
var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 1280, 720, ctx.CurrentItem, "cbs-picture3LinesImg", line1, pictureId);
var containerId = encodedId + "container";
var pictureLinkId = encodedId + "pictureLink";
var videoId = encodedId + "video";
var pictureContainerId = encodedId + "pictureContainer";
var dataContainerId = encodedId + "dataContainer";
var line1LinkId = encodedId + "line1Link";
var line1Id = encodedId + "line1";
var dataDisplayTemplateTitle = "ItemCarousel";
_#-->
<div class="cbs-picture3LinesContainer" id="_#= containerId =#_" data-displaytemplate="_#= $htmlEncode(dataDisplayTemplateTitle) =#_">
<div class="cbs-picture3LinesImageContainer" id="_#= pictureContainerId =#_">
<!--#_
if (contentType=="Activo de imagen") {_#-->
_#= pictureMarkup =#_
<!--#_} else
{
var MediaURL = videoFileURL;
var PreviewURL = pictureMarkup;
var MediaTitle = title;
var AutoPlay = "true";
var Loop = "false";
mediaPlayer.createMediaPlayer(
document.getElementById(pictureContainerId),pictureContainerId,'1600','900px',
{
displayMode:'Inline',
mediaTitle:MediaTitle,
mediaSource:MediaURL,
previewImageSource:PreviewURL,
autoPlay:AutoPlay,
loop:Loop,
mediaFileExtensions:'wmv;wma;avi;mpg;mp3;',
silverlightMediaExtensions:'wmv;wma;mp3;'
});
}_#-->
</div>
</div>
</div>
</body>
</HTML>
From already thank you very much.
Hi,
Try to check whether the mediaPlayer got loaded.
For example:
If not loaded, try with
includeScript(this.url, "~sitecollection/_layouts/15/mediaplayer.js") instead of RegisterSod;
Best Regards,
Lee
这篇关于该对象不接受'createMediaPlayer'属性或方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!