Android browser media player (stagefright?) displayed media name

会有一股神秘感。 提交于 2019-12-05 20:22:51

The short answer is no. I don't think you can change the displayed title to show something else from the server.

I believe that player is the default AudioPreview activity from the default AOSP Music app. Looking at it's source code, apparently it will simply use the last path segment of the URI for stream using the HTTP scheme (it will only query the media database for local content/files).

Here are the relevant code snippets:

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    // ...

    if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {

        // ...

    } else if (scheme.equals("file")) {

        // ...

    } else {
        // We can't get metadata from the file/stream itself yet, because
        // that API is hidden, so instead we display the URI being played
        if (mPlayer.isPrepared()) {
            setNames();
        }
    }
}

// ...

public void setNames() {
    if (TextUtils.isEmpty(mTextLine1.getText())) {
        mTextLine1.setText(mUri.getLastPathSegment());
    }
    if (TextUtils.isEmpty(mTextLine2.getText())) {
        mTextLine2.setVisibility(View.GONE);
    } else {
        mTextLine2.setVisibility(View.VISIBLE);
    }
}

Try using a filename without spaces. I have seen that android has problem with spaces in filenames. It might help.

Content-Disposition: inline; filename=Some_Better_Title
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!