Javascript problems

Sep 24, 2010 at 1:23 PM

Hi,

I'm having problems integrating my custom SMF player with the javascript API provided in the SMF. I've just used the "player.html" document provided with the JavaScriptPlaylist example in the SMF.

If I use this html doc with the SmoothStreamingPlayer.xap (provided with the SMF) it works fine. Now I replace the SmoothStreamingPlayer.xap with my custom xap, then make sure I change the reference in the html code, and it no longer works. When I click the "Create New Playlist in Javascript" button I get an on page error with no details. But it gets thrown on the line I first try to call to the Player within the javascript. I've checked the pluginLoaded function gets called and the slCtrl var gets assigned.

So to make things simpler I stripped down my custom player so that all I have is the code below. But it still doesn't work. Can anyone help?

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:Core="clr-namespace:Microsoft.SilverlightMediaFramework.Core;assembly=Microsoft.SilverlightMediaFramework.Core"
    xmlns:Media="clr-namespace:Microsoft.SilverlightMediaFramework.Core.Media;assembly=Microsoft.SilverlightMediaFramework.Core"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:converters="clr-namespace:QPlayer.Converters"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns:System="clr-namespace:System;assembly=mscorlib" xmlns:smf_converters="http://schemas.microsoft.com/smf/2010/xaml/converters" xmlns:smf_accesscontrols="http://schemas.microsoft.com/smf/2010/xaml/accesscontrols" x:Class="QPlayer.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">
        <Core:SMFPlayer x:Name="MyPlayer" PlayerGraphVisibility="Hidden" AutoPlay="True"/>
    </Grid>
</UserControl>
  
Sep 24, 2010 at 6:53 PM

Add the Property, ScriptableName="Player", to Core:SMFPlayer.  I do recall that is the nasty trick that gets everything to work properly.

Sep 27, 2010 at 8:30 AM

Thanks! This worked. This property should have been set by the initParams passed from the html doc, however it seems there's a bug somewhere here.