Skip to content

Conversation

@lefirea
Copy link

@lefirea lefirea commented Jul 25, 2025

MUXに送信するパラメータにviewerPlanStatusを追加し、視聴プラン(OneTimePlan or SubscriptionPlan)を記録できるようにした
https://linear.app/glucose/issue/SRS-576

App側の修正:https://github.com/glucoseinc/shirasu-app/pull/408


Android側は、mux-stats-sdk-exoplayerからは送れなかったので、mux-stats-sdk-media3に移行した。
それに伴い、exoplayer2からmedia3に移行した。
補足として、下記のように移行が推奨されていたのでいずれ必要なことではあった。

現在スタンドアロンの com.google.android.exoplayer2 ライブラリと androidx.media を使用しているアプリは、androidx.media3 に移行する必要があります。
https://developer.android.com/media/media3/exoplayer/migration-guide?hl=ja

media3への移行作業はflutter-packagesのフォーク元が既に対応していたので取り込むことで対応した。
その後、弊社の独自拡張分を手作業で修正した。
具体的な手順は以下。

# 1. 作業用ブランチを切る
git checkout -b media3

# 2. フォーク元から取り込みたい部分(`video_player_android/`)だけを取り込む
git checkout upstream/main -- packages/video_player/video_player_android

# 3. 弊社側の最新コミット(`5bb58fc`)でrebaseして、弊社側の追加分を加え直す
# ※ 2. でファイルが丸々上書きされて弊社分が消えるので、rebaseして加える必要がある
git rebase 5bb58fc

# (ここまででexoplayerからmedia3への移行は終了)

# 4. `mux-stats-sdk-exoplayer`から`mux-stats-sdk-media3`に移行する
手作業で当該パッケージ使用部分を書き換える

この取り込み作業のコミット:chore: exoplayerからmedia3に移行 f06b94f

この手順のあと、viewer_plan_statusを送信するコードを追加した。


MUXのパッケージ更新に伴い、videoData.setVideoCdnがdeprecatedになっていたので削除した。

iOS側はパッケージのバージョンアップ以外の作業は不要だった。

@lefirea lefirea marked this pull request as ready for review August 12, 2025 05:55
@lefirea lefirea requested a review from Copilot August 12, 2025 06:03

This comment was marked as outdated.

@lefirea lefirea requested a review from Copilot August 12, 2025 06:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new viewerPlanStatus parameter to MUX configuration to track viewing plans (OneTimePlan or SubscriptionPlan). The Android implementation migrates from ExoPlayer2 to Media3 and updates the MUX SDK accordingly, while iOS only requires a package version update.

  • Adds viewerPlanStatus parameter to MUX configuration across all platform interfaces
  • Migrates Android video player from ExoPlayer2 to Media3 with updated MUX SDK
  • Updates iOS MUX Stats dependency to version 4.0

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
video_player_platform_interface.dart Adds viewerPlanStatus field to MuxConfig class
video_player_avfoundation/pigeons/messages.dart Adds viewerPlanStatus to MuxConfigMessage pigeon definition
video_player_avfoundation/lib/src/messages.g.dart Generated pigeon code updates for new field
video_player_avfoundation/lib/src/avfoundation_video_player.dart Maps viewerPlanStatus to MUX message
video_player_avfoundation/ios/video_player_avfoundation.podspec Updates MUX Stats dependency to 4.0
iOS native files Updates pigeon-generated code and implements MUX viewer data
Android files Comprehensive migration from ExoPlayer2 to Media3 with MUX SDK updates


if (arg.getVideoCdn() != null)
videoData.setVideoCdn(arg.getVideoCdn());
// deprecatedになったが、iOS版との統一のために残しておく
Copy link

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment contains mixed languages (Japanese and English). Consider using consistent language in comments for better code maintainability.

Suggested change
// deprecatedになったが、iOS版との統一のために残しておく
// This is deprecated, but kept for consistency with the iOS version.

Copilot uses AI. Check for mistakes.
PendingIntent sessionActivity = buildSessionActivityPendingIntent(context);

MediaSession.Builder builder = new MediaSession.Builder(context, exoPlayer).setId("VideoPlayer");
if(sessionActivity != null){
Copy link

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after if keyword. Should be if (sessionActivity != null) { to follow Java formatting conventions.

Suggested change
if(sessionActivity != null){
if (sessionActivity != null) {

Copilot uses AI. Check for mistakes.
@lefirea lefirea requested a review from Copilot August 12, 2025 07:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

PlaybackSpeedMessage pigeonResult = new PlaybackSpeedMessage();
Object textureId = list.get(0);
pigeonResult.setTextureId((textureId == null) ? null : ((textureId instanceof Integer) ? (Integer) textureId : (Long) textureId));
pigeonResult.setTextureId(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

badge
lintが崩れてるので直してください

@lefirea lefirea requested a review from ryo0511 August 19, 2025 05:58
wrapped.add(0, null);
}
catch (Throwable exception) {
} catch (Throwable exception) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他の箇所もlint崩れてるので直してください

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一通り直しました
これで大丈夫だと思います

@lefirea lefirea requested a review from ryo0511 August 21, 2025 09:43
@ryo0511
Copy link

ryo0511 commented Aug 22, 2025

この変更は以降スクリプトによるものですか?
https://developer.android.com/media/media3/exoplayer/migration-guide?hl=ja#usingscript

 media3への移行作業はflutter-packagesのフォーク元が既に対応していたので取り込むことで対応した。

これはどの部分がそうですか?
取り込んだ部分と自前で手を加えた部分とがコミットでわかるようにするか、欲を言えば別PRにしてもらった方が経緯が追えて助かります

@lefirea
Copy link
Author

lefirea commented Aug 25, 2025

@ryo0511
取り込み手順をPR本文に追記しました
ご確認ください。

フォーマットが変わってる部分については、この取り込み手順で発生した部分です。
フォーク元でそのフォーマットになってます。

スクリプトについては、フォーク元がスクリプトを使って移行しており、今回の作業ではその移行後を取り込んでます

@ryo0511 ryo0511 merged commit 82cdfde into glucose-hosted Aug 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants