media-kit / media-kit

A cross-platform video player & audio player for Flutter & Dart.
https://github.com/media-kit/media-kit
MIT License
893 stars 126 forks source link

how to seprate #778

Closed hasanm08 closed 3 weeks ago

hasanm08 commented 4 weeks ago

I want to use your package only on ios web and safari browser and for other platforms use video_player. what files should i use and how can i add them step by step?

abdelaziz-mahdy commented 4 weeks ago

do you want to use same code as video_player?

follow this in that case https://github.com/media-kit/media-kit/tree/main/video_player_media_kit

for the point of safari browser it may be hard to select based on what browser i dont have experience in that part

hasanm08 commented 4 weeks ago

I have issues for android app sizes when i added media_kit and used it for web. Do you have any ideas to handel this? Maybe thease can help, but i don't know how?

https://docs.flutter.dev/packages-and-plugins/developing-packages

flutter: plugin: platforms: android: package: com.example.hello pluginClass: HelloPlugin ios: pluginClass: HelloPlugin macos: pluginClass: HelloPlugin web: pluginClass: HelloPlugin fileName: hello_web.dart

abdelaziz-mahdy commented 4 weeks ago

you are making a package? what is the use case? and can you show me the pubspec?

abdelaziz-mahdy commented 4 weeks ago

also check the link

hasanm08 commented 4 weeks ago

I am using video_viewer package for hls streaming. But it has issues on hls streaming on web. So i want to merge it with your code and fix this issue in best perfomant casem

hasanm08 commented 4 weeks ago

also check the link

I checked that package but are you sure about handling web issues and android size issues? Should i use that for both platforms?

abdelaziz-mahdy commented 3 weeks ago

I am using video_viewer package for hls streaming. But it has issues on hls streaming on web. So i want to merge it with your code and fix this issue in best perfomant casem

In that case you can import the web only, which will not increase size for other platforms

abdelaziz-mahdy commented 3 weeks ago

also check the link

I checked that package but are you sure about handling web issues and android size issues? Should i use that for both platforms?

I don't understand the android size problems, for web yes the package handles hls

hasanm08 commented 3 weeks ago

also check the link

I checked that package but are you sure about handling web issues and android size issues? Should i use that for both platforms?

I don't understand the android size problems, for web yes the package handles hls

I checked that but i cannot find media_kit_libs_web To add as depandency after i made web field to true

abdelaziz-mahdy commented 3 weeks ago

There is no libs for web

Just adding the package and setting web to true is enough

hasanm08 commented 3 weeks ago

There is no libs for web

Just adding the package and setting web to true is enough

I tried this way but it causes some depracated logs and no playing in web platform

abdelaziz-mahdy commented 3 weeks ago

Share the logs and a screenshot

hasanm08 commented 3 weeks ago

Share the logs and a screenshot

`` The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it fromdart:ui_web` instead.



onInitError other 2.718281828459045 http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3
throw_
http://localhost:51150/packages/media_kit/src/models/media/media_web.dart 82:7                      new
http://localhost:51150/packages/video_player_media_kit/src/media_kit_video_player.dart 114:7        create
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54           runBody
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5           _async
http://localhost:51150/packages/video_player_media_kit/src/media_kit_video_player.dart 69:22        create
http://localhost:51150/packages/video_player/video_player.dart 434:46                               initialize
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54           runBody
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5           _async
http://localhost:51150/packages/video_player/video_player.dart 392:26                               initialize
http://localhost:51150/packages/video_viewer/domain/bloc/controller.dart 788:32                     changeSource
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54           runBody
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5           _async
http://localhost:51150/packages/video_viewer/domain/bloc/controller.dart 742:28                     changeSource
http://localhost:51150/packages/video_viewer/domain/bloc/controller.dart 822:17                     <fn>
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50           <fn>
http://localhost:51150/dart-sdk/lib/async/zone.dart 1407:47                                         _rootRunUnary
http://localhost:51150/dart-sdk/lib/async/zone.dart 1308:19                                         runUnary
http://localhost:51150/dart-sdk/lib/async/future_impl.dart 162:18                                   handleValue
http://localhost:51150/dart-sdk/lib/async/future_impl.dart 838:44                                   handleValueCallback
http://localhost:51150/dart-sdk/lib/async/future_impl.dart 867:13                                   _propagateToListeners
http://localhost:51150/dart-sdk/lib/async/future_impl.dart 634:7                                    [_complete]
http://localhost:51150/dart-sdk/lib/async/future.dart 419:15                                        <fn>
http://localhost:51150/dart-sdk/lib/async/zone.dart 1391:47                                         _rootRun
http://localhost:51150/dart-sdk/lib/async/zone.dart 1301:19                                         run
http://localhost:51150/dart-sdk/lib/async/zone.dart 1209:7                                          runGuarded
http://localhost:51150/dart-sdk/lib/async/zone.dart 1249:23                                         <fn>
http://localhost:51150/dart-sdk/lib/async/zone.dart 1399:13                                         _rootRun
http://localhost:51150/dart-sdk/lib/async/zone.dart 1301:19                                         run
http://localhost:51150/dart-sdk/lib/async/zone.dart 1233:23                                         <fn>
http://localhost:51150/dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11      internalCallback
abdelaziz-mahdy commented 3 weeks ago
The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it from dart:ui_web instead.

this is not a problem for now, it shouldnt cause a problem , the logs you shared is missing the error thrown, its only the stack trace

if thats the error onInitError other 2.718281828459045 then i dont know sadly

you can try https://pub.dev/packages/video_player_web_hls if your use case for web requires hls since they support it too

hasanm08 commented 3 weeks ago

if thats the error onInitError other 2.718281828459045 then i dont know sadly

currently i am using web hls package this is redundant error with diffrent number 2538 The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it from `dart:ui_web` instead. onInitError other 2.718281828459045 http://localhost:53823/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3 throw_

abdelaziz-mahdy commented 3 weeks ago

as i mentinoed The platformViewRegistry getter is deprecated and will be removed in a future release. Please import it from dart:ui_web instead. this is a warning which shouldnt cause a problem

abdelaziz-mahdy commented 3 weeks ago

note that in media_kit we are using import 'dart:ui_web'; so its not from our side

hasanm08 commented 3 weeks ago

i found a better error text Unsupported operation: HTTP headers are not supported on web and i fixed the deprecated issue for you in this #782

abdelaziz-mahdy commented 3 weeks ago

i found a better error text Unsupported operation: HTTP headers are not supported on web and i fixed the deprecated issue for you in this #782

I still can't find the fix, since you didn't change the import itself, so I don't see the need for the pr. I am ignoring the other changes which are unrelated

hasanm08 commented 3 weeks ago

i found a better error text Unsupported operation: HTTP headers are not supported on web and i fixed the deprecated issue for you in this #782

I still can't find the fix, since you didn't change the import itself, so I don't see the need for the pr. I am ignoring the other changes which are unrelated

because you imported html and ui_web it uses html methods that marked as deprecated and if you want to fix. you should using direct import using as keyword. about the error Unsupported operation: HTTP headers are not supported on web I noticed that you throw it your self in media_kit\lib\src\models\media\media_web.dart line 93. can't we avoid exception and handle it in another way? i swapped exception with print and return but after priniting media_kit: WebVideoController: 1920, 1080 nothing happened. what should I do?

abdelaziz-mahdy commented 3 weeks ago

I think instead of changing the logic inside the package, you could send null http headers for web from your side, the exception is an exception since if this warning was not seen it will cause alot of harm to people who believe it's set

Btw the pr has alot of changes unrelated to web warning, so please a open a pr only for web warning alone, no need for dependency updates nor logic edits

hasanm08 commented 3 weeks ago

I think instead of changing the logic inside the package, you could send null http headers for web from your side, the exception is an exception since if this warning was not seen it will cause alot of harm to people who believe it's set

Btw the pr has alot of changes unrelated to web warning, so please a open a pr only for web warning alone, no need for dependency updates nor logic edits

but i didn't add any headers. can you check your package for any bad assign or anything else?

abdelaziz-mahdy commented 3 weeks ago

I think instead of changing the logic inside the package, you could send null http headers for web from your side, the exception is an exception since if this warning was not seen it will cause alot of harm to people who believe it's set Btw the pr has alot of changes unrelated to web warning, so please a open a pr only for web warning alone, no need for dependency updates nor logic edits

but i didn't add any headers. can you check your package for any bad assign or anything else?

check this change https://github.com/media-kit/media-kit/pull/783