Reputation: 32227
If I play my MP4 in QuickTime
I can see my closed captioning messages on the display.
Thanks to QuickTime
I know the metadata is there so I'm trying to display the CC in my flash video player as well. However, both methods of pulling out metadata are only returning information on video load and I never get anything else.
I'm guessing I'm not loading metadata from the mp4 correctly? Or perhaps the CC data is not in the meta data?
private function streamMetaData(obj:Object):void {
this._metaData = obj;
for(var key:String in obj) {
trace("STREAM_METADATA: " + key + "=" + obj[key]);
}
}
private function onMetaData(event:OvpEvent):void {
for(var key:String in event.data) {
trace("METADATA: " + key + "=" + event.data[key]);
}
}
this._sprite = new AkamaiMediaSprite(); // essentially synonymous with OVP (OSMF)
this.sprite.addEventListener(OvpEvent.METADATA, this.onMetaData, false, 0, true);
this.sprite.netStream.client = {onMetaData:this.streamMetaData};
STREAM_METADATA: trackinfo=[object Object],[object Object],[object Object]
STREAM_METADATA: avcprofile=77
STREAM_METADATA: duration=1657.835
STREAM_METADATA: moovPosition=131287896
STREAM_METADATA: width=512
STREAM_METADATA: avclevel=21
STREAM_METADATA: height=288
STREAM_METADATA: audiosamplerate=44100
STREAM_METADATA: videoframerate=15
STREAM_METADATA: videocodecid=avc1
STREAM_METADATA: audiocodecid=mp4a
STREAM_METADATA: audiochannels=2
STREAM_METADATA: aacaot=2
METADATA: trackinfo=[object Object],[object Object],[object Object]
METADATA: avcprofile=77
METADATA: duration=1657.835
METADATA: moovPosition=131287896
METADATA: width=512
METADATA: avclevel=21
METADATA: height=288
METADATA: audiosamplerate=44100
METADATA: videoframerate=15
METADATA: videocodecid=avc1
METADATA: audiocodecid=mp4a
METADATA: audiochannels=2
METADATA: aacaot=2
Upvotes: 0
Views: 1818
Reputation: 7449
Since there are 3 tracks in the video, according to this:
STREAM_METADATA: trackinfo=[object Object],[object Object],[object Object]
... it's likely that one of them is a CC track. I.e., rather than being metadata, the CC are embedded as a track. May give more info if you trace the properties of those three objects in your streamMetaData
method.
You might want to give OvpEvent.NETSTREAM_TEXTDATA
a try also. That looks like a relay of NetStream's onTextData event, which tends to work for getting embedded captions.
this.sprite.addEventListener(OvpEvent.NETSTREAM_TEXTDATA, this.onTextData, false, 0, true);
Examine the event object (same as you do for the others), because the docs make little sense, speaking about an info
property on OvpEvent, although it doesn't seem to have one (so they probably mean data
like in onMetaData).
Upvotes: 0
Reputation: 2331
I'm not familiar with the specific video library you are using, but if it's "practically synonymous with Open Video Player" I found something interesting in their docs: they have an event for captions OvpEvent.CAPTION
that passes along a org.openvideoplayer.cc.Caption
object.
Maybe this will work (untested):
private function onCaptionEvent(event:OvpEvent):void {
if (event.data is Caption) {
var caption:Caption = (event.data as Caption);
trace("Caption:", caption.text);
trace("Start time:", caption.startTime);
trace("End time:", caption.endTime);
}
}
this.sprite.addEventListener(OvpEvent.CAPTION, this.onCaptionEvent, false, 0, true);
Upvotes: 1