Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling non-standard file extensions #45

Closed
dsilhavy opened this issue Jul 21, 2023 · 11 comments
Closed

Handling non-standard file extensions #45

dsilhavy opened this issue Jul 21, 2023 · 11 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dsilhavy
Copy link
Contributor

Feature description
We are currently initializing the ExoPlayer with MediaItem mediaItem = MediaItem.fromUri(videoUri);. This has the downside that the URI needs to have a standard file extension, in order for the corresponding media source to be automatically created. In cases in which an MPD is missing .mpd in the filename, this can cause an issue.

In situations in which we know the content type because it is defined in the ServiceAccessInformation (for instance application/dash+xml for DASH) we can provide this information to the Exoplayer. As a consequence, a non-existent file extensions will not cause an error.

// Use the explicit MIME type to build an HLS media item.
MediaItem mediaItem = new MediaItem.Builder()
    .setUri(hlsUri)
    .setMimeType(MimeTypes.APPLICATION_M3U8)
    .build();

See: https://exoplayer.dev/media-items.html

@dsilhavy dsilhavy added the enhancement New feature or request label Jul 21, 2023
@dsilhavy dsilhavy added this to the Version 1.1.0 milestone Jul 21, 2023
@dsilhavy dsilhavy self-assigned this Jul 21, 2023
@dsilhavy dsilhavy modified the milestones: Version 1.1.0, Version 1.0.1 Jul 27, 2023
@dsilhavy
Copy link
Contributor Author

Addressed in #46

@rjb1000
Copy link

rjb1000 commented Aug 17, 2023

Testing on Monday by @jonniebeeb of the latest version (from @dsilhavy's development branch) suggests that this fix might not be working as expected. See attached log3 2023-08-14.txt.

The version number from the log is as follows:

ExoPlayerImpl: Init ea9a8db [AndroidXMedia3/1.0.2] [lynx, Pixel 7a, Google, 33]

And we are seeing errors of the following sort:

08-14 14:11:46.726 23239 23239 E EventLogger: internalError [eventTime=23.44, mediaPos=0.00, window=0, period=0, loadError
08-14 14:11:46.726 23239 23239 E EventLogger:   androidx.media3.exoplayer.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
08-14 14:11:46.726 23239 23239 E EventLogger:       at androidx.media3.exoplayer.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:94)
08-14 14:11:46.726 23239 23239 E EventLogger:       at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1018)
08-14 14:11:46.726 23239 23239 E EventLogger:       at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:414)
08-14 14:11:46.726 23239 23239 E EventLogger:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
08-14 14:11:46.726 23239 23239 E EventLogger:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
08-14 14:11:46.726 23239 23239 E EventLogger:       at java.lang.Thread.run(Thread.java:1012)
08-14 14:11:46.726 23239 23239 E EventLogger: ]
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal: Playback error
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:   androidx.media3.exoplayer.ExoPlaybackException: Source error
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:652)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:622)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:102)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at android.os.Looper.loopOnce(Looper.java:201)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:288)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:67)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:   Caused by: androidx.media3.exoplayer.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:94)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1018)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:414)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
08-14 14:11:46.727 23239 23272 E ExoPlayerImplInternal:       at java.lang.Thread.run(Thread.java:1012)
08-14 14:11:46.732 23239 23239 E EventLogger: playerFailed [eventTime=23.45, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
08-14 14:11:46.732 23239 23239 E EventLogger:   androidx.media3.exoplayer.ExoPlaybackException: Source error
08-14 14:11:46.732 23239 23239 E EventLogger:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:652)
08-14 14:11:46.732 23239 23239 E EventLogger:       at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:622)
08-14 14:11:46.732 23239 23239 E EventLogger:       at android.os.Handler.dispatchMessage(Handler.java:102)
08-14 14:11:46.732 23239 23239 E EventLogger:       at android.os.Looper.loopOnce(Looper.java:201)
08-14 14:11:46.732 23239 23239 E EventLogger:       at android.os.Looper.loop(Looper.java:288)
08-14 14:11:46.732 23239 23239 E EventLogger:       at android.os.HandlerThread.run(HandlerThread.java:67)
08-14 14:11:46.732 23239 23239 E EventLogger:   Caused by: androidx.media3.exoplayer.source.UnrecognizedInputFormatException: None of the available extractors (FlvExtractor, FlacExtractor, WavExtractor, FragmentedMp4Extractor, Mp4Extractor, AmrExtractor, PsExtractor, OggExtractor, TsExtractor, MatroskaExtractor, AdtsExtractor, Ac3Extractor, Ac4Extractor, Mp3Extractor, AviExtractor, JpegExtractor) could read the stream.
08-14 14:11:46.732 23239 23239 E EventLogger:       at androidx.media3.exoplayer.source.BundledExtractorsAdapter.init(BundledExtractorsAdapter.java:94)
08-14 14:11:46.732 23239 23239 E EventLogger:       at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1018)
08-14 14:11:46.732 23239 23239 E EventLogger:       at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:414)
08-14 14:11:46.732 23239 23239 E EventLogger:       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
08-14 14:11:46.732 23239 23239 E EventLogger:       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
08-14 14:11:46.732 23239 23239 E EventLogger:       at java.lang.Thread.run(Thread.java:1012)
08-14 14:11:46.732 23239 23239 E EventLogger: ]
08-14 14:11:46.732 23239 23239 D ExoPlayer: Error

@rjb1000 rjb1000 reopened this Aug 17, 2023
@dsilhavy
Copy link
Contributor Author

@rjb1000 @jonniebeeb I was unable to reproduce this in my local setup:

M8

After starting the 5GMSd Aware Application I select the following entry from my m8.js:

{
  provisioningSessionId: 8,
  name: 'Local to nosuffix'
}

M5

The Service Access Information at M5 returns the following for provisioningSessionId 8:

8: {
    provisioningSessionId: 8,
        provisioningSessionType: 'DOWNLINK',
        streamingAccess: {
        entryPoints: [
            {
                locator: baseURL+ ':3003/redirect/nosuffix',
                contentType: 'application/dash+xml',
                profiles: [
                    'urn:mpeg:dash:profile:isoff-live:2011'
                ]
            }
        ]
    }
},

In this case, the locator URL has no .mpd file extension. Note that the contentType needs to be set to application/dash+xm otherwise the feature implemented in this issue is not working.

Requesting the resource

Now the client requests the MPD at baseURL+ ':3003/redirect/nosuffix' which returns:

router.get('/nosuffix', function (req, res, next) {
    res.writeHead(302, {
        'Content-Type': '',
        'Location': 'http://192.168.2.1:3333/steering-content/bbb/alpha/fivegmag-nosuffix'
    });
    res.end();
});

We are creating a redirect to another location http://192.168.2.1:3333/steering-content/bbb/alpha/fivegmag-nosuffix again with no file extension.

Result

Playback starts as expected

Next steps

  1. Can you make sure that you have the correct contentType specified in your ServiceAccessInformation.
  2. Can you paste your ServiceAccessInformation in this ticket
  3. Do your media segments have a file extension e.g. mp4, m4s or something similar?

@davidjwbbc
Copy link

For reference here's the /etc/rt-5gms/streams.json file I've been using to configure the AF & AS.

{
    "aspId": "MyASPId",
    "appId": "IBCDemoApp",
    "streams": {
	"ed": {
	    "name": "M5: Elephant's Dream",
	    "ingestURL": "http://localhost:8080/ElephantsDream/",
	    "distributionConfigurations": [
		{
		    "domainNameAlias": "as.5g.demo",
		    "entryPoint": {
			"relativePath": "manifest.mpd",
			"contentType": "application/dash+xml",
			"profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
		    }
		}
	    ]
	},
	"ld": {
	    "name": "M5: Llama Drama",
	    "ingestURL": "http://localhost:8080/CaminandesLlamaDrama4K/",
	    "distributionConfigurations": [
		{
		    "domainNameAlias": "as.5g.demo",
		    "entryPoint": {
			"relativePath": "manifest.mpd",
			"contentType": "application/dash+xml",
			"profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
		    }
		}
	    ]
	},
	"vod": {
	    "name": "M5: All streams",
	    "ingestURL": "http://localhost:8080/",
	    "distributionConfigurations": [
		{
		    "domainNameAlias": "as.5g.demo"
		}
	    ]
	}
    },
    "vodMedia": [
	{
	    "name": "M8: Elephant's Dream",
	    "stream": "vod",
	    "entryPoints": [
		{
                    "relativePath": "ElephantsDream/manifest.mpd",
                    "contentType": "application/dash+xml",
                    "profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
                }
	    ]
	},
	{
	    "name": "M8: Llama Drama",
	    "stream": "vod",
            "entryPoints": [
                {
                    "relativePath": "CaminandesLlamaDrama4K/manifest.mpd",
                    "contentType": "application/dash+xml",
                    "profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
                }
            ]
	}
    ]
}

Where as.5g.demo is resolved by our local DNS to the AS host address.

@davidjwbbc
Copy link

davidjwbbc commented Aug 18, 2023

Alternatively you could use this to reference the original Azure Media Player demos hosts:

{
    "aspId": "BBC-RD-5G",
    "appId": "BBCRD5GTestbed",
    "streams": {
	"ed": {
	    "name": "M5: Elephant's Dream [AMS]",
	    "ingestURL": "http://amssamples.streaming.mediaservices.windows.net/b6822ec8-5c2b-4ae0-a851-fd46a78294e9/ElephantsDream.ism/",
	    "distributionConfigurations": [
		{
		    "entryPoint": {
			"relativePath": "manifest(format=mpd-time-csf)",
			"contentType": "application/dash+xml",
			"profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
		    }
		},
		{
                    "entryPoint": {
                        "relativePath": "manifest(format=m3u8-aapl-v3)",
                        "contentType": "application/vnd.apple.mpegurl"
                    }
		}
	    ]
	},
	"ld": {
	    "name": "M5: Llama Drama [AMS]",
	    "ingestURL": "http://amssamples.streaming.mediaservices.windows.net/634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/",
	    "distributionConfigurations": [
		{
		    "entryPoint": {
			"relativePath": "manifest(format=mpd-time-csf)",
			"contentType": "application/dash+xml",
			"profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
		    }
		},
		{
                    "entryPoint": {
                        "relativePath": "manifest(format=m3u8-aapl-v3)",
                        "contentType": "application/vnd.apple.mpegurl"
                    }
		}
	    ]
	},
	"vodamp": {
	    "name": "M5: AMP Demo Streams [AMS]",
	    "ingestURL": "http://amssamples.streaming.mediaservices.windows.net/",
	    "distributionConfigurations": [
		    {}
	    ]
	}
    },
    "vodMedia": [
	{
	    "name": "M8: Elephant's Dream [AMS]",
	    "stream": "vodamp",
	    "entryPoints": [
		{
                    "relativePath": "b6822ec8-5c2b-4ae0-a851-fd46a78294e9/ElephantsDream.ism/manifest(format=mpd-time-csf)",
                    "contentType": "application/dash+xml",
                    "profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
                },
		{
                    "relativePath": "b6822ec8-5c2b-4ae0-a851-fd46a78294e9/ElephantsDream.ism/manifest(format=m3u8-aapl-v3)",
                    "contentType": "application/vnd.apple.mpegurl"
                }
	    ]
	},
	{
	    "name": "M8: Llama Drama [AMS]",
	    "stream": "vodamp",
            "entryPoints": [
                {
                    "relativePath": "634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest(format=mpd-time-csf)",
                    "contentType": "application/dash+xml",
                    "profiles": ["urn:mpeg:dash:profile:isoff-live:2011"]
                },
                {
                    "relativePath": "634cd01c-6822-4630-8444-8dd6279f94c6/CaminandesLlamaDrama4K.ism/manifest(format=m3u8-aapl-v3)",
                    "contentType": "application/vnd.apple.mpegurl"
                }
            ]
	}
    ]
}

@davidjwbbc
Copy link

Done some more testing today and we've had the app successfully play back both versions (M8 entry point and M5 SAI entry point). We'd had a few minor issues with the M5 interface (always returned 404 due to a configuration issue), the DNS (DNS server wasn't running for our standalone demo) and some AS directory permissions. Having tidied those up we could debug, but were still seeing the same issue so I've done a full rebuild and redeploy of the AF, the App and its libraries and the Media Session Handler Service. Since the rebuild it's been working as expected, so it's possible that something somewhere had gotten out of sync.

I'd like to test against our other AS/AF server to make sure the redeploy works there too.

@dsilhavy
Copy link
Contributor Author

Thanks for testing @davidjwbbc . I leave this issue open until you did the final test.

@rjb1000
Copy link

rjb1000 commented Aug 22, 2023

I've done a full rebuild and redeploy of the AF, the App and its libraries and the Media Session Handler Service. Since the rebuild it's been working as expected, so it's possible that something somewhere had gotten out of sync.

We suspect the libraries were either not recompiled or not redeployed to Maven, so an old library was being packaged up.

I wonder if it's possible to spit out a library version number in the application logs to help with future debugging?

@dsilhavy
Copy link
Contributor Author

I've done a full rebuild and redeploy of the AF, the App and its libraries and the Media Session Handler Service. Since the rebuild it's been working as expected, so it's possible that something somewhere had gotten out of sync.

We suspect the libraries were either not recompiled or not redeployed to Maven, so an old library was being packaged up.

I wonder if it's possible to spit out a library version number in the application logs to help with future debugging?

Addressed in

@dsilhavy dsilhavy modified the milestones: Version 1.0.1, Version 1.0.2 Aug 25, 2023
@dsilhavy
Copy link
Contributor Author

@rjb1000 @davidjwbbc : Forgot this in the call today. Can we close this issue?

@rjb1000
Copy link

rjb1000 commented Aug 25, 2023

Yes, we can close, @dsilhavy. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

3 participants