Вопрос

I've been trying to get closed captions working with the SEF player, but haven't had any luck. My app uses playready streams and I've tried side loading the SAMI files, but I get errors. I would prefer to do side loading, but if I can get embedded closed captions to work that would be a first step. There seems to be limited and conflicting documentation and posts on the Samsung developer's forum so I'm hoping to find someone who has gotten this to work on 2012/2013 devices.

Here's what I have tried:

var SefPlugin = document.getElementById('pluginDL');
alert(" " + SefPlugin.Open("Download", "1.000", ""));
alert(SefPlugin.Execute('GetPluginInfo'));

var ret = SefPlugin.Execute('StartDownFile', 'http://testurl.com/test.smi', '$TEMP/subtitle.smi', 10, 10);
alert("SUBTITLE DOWNLOAD RETURNED: "  + ret);

The output is:

    JS ALERT: 1
    JS ALERT: 1
    JS ALERT: SUBTITLE DOWNLOAD RETURNED: 1

Then in the OnStreamInfoReady method I attempt to do this:

   alert(" START SUBTITLE: " +Player.plugin.Execute("StartSubtitle", '$TEMP/subtitle.smi'));
   alert("SET STREAM ID: " +Player.plugin.Execute("SetStreamID", 5, 0));

The output is:

    JS ALERT:   START SUBTITLE: -1
    JS ALERT:  SET STREAM ID: 1

The StartSubtitle returning -1 is an error and I'm not sure what the problem is with this scenario.

I also tried the AVPlay plugin by downloading the subtitle file the same way as above. Then, I tried to initiate a play action by calling:

var subtitleDataCallback = (function(syncTime, data) {
    alert(syncTime + " : " + data);
})();

Main.AVPlayerObj.open('http://testurl.com/test.mp4',
  {
          subtitle: {
              path: "subtitle.smi",
              streamID : 0,
              sync : 1000,
              subtitleDataCallback: subtitleDataCallback
          }
});

It plays the content if I leave out the subtitle object, but when I have the subtitle object there it gives me the following error:

    JS ALERT:  ======================================= ERROR2: TYPE_MISMATCH_ERR

I tried $TEMP/subtitle.smi for the path as well, but I receive the same mismatch error. Any guidance would be greatly appreciated.

Это было полезно?

Решение

I never actually got subtitle files to work with the player. I found a subtitle parser and ripped it out from (http://mediaelementjs.com/). It gives you each subtitle entry in an array that has the time when the subtitle should start showing and when it should stop showing.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top